data-structures · advanced · ~15 min

Quicksort

Recursive partitioning; pivot choice; tail-call shape.

Challenge

Implement void quicksort(int *a, size_t n) sorting a ascending in place using a recursive partitioning scheme of your choice (Lomuto or Hoare).

Starter code

#include <stddef.h>

void quicksort(int *a, size_t n) {
    /* TODO */
}

Solve this exercise in the browser editor — compile and run against the test harness, no setup required.