Skip to content

Instantly share code, notes, and snippets.

@leomastoras
Created April 14, 2024 09:58
Show Gist options
  • Save leomastoras/81fc12ad53dc6fe0d8a4eeb13283f915 to your computer and use it in GitHub Desktop.
Save leomastoras/81fc12ad53dc6fe0d8a4eeb13283f915 to your computer and use it in GitHub Desktop.
Beauty Quicksort
void quicksort(int l, int u) {
int i, m;
if (l >= u) return;
m = l;
for (i = l+1; i <= u; i++)
if (x[i] < x[l])
swap(++m, i);
swap(l, m);
quicksort(l, m-1);
quicksort(m+1, u);
}
// https://www.youtube.com/watch?v=QvgYAQzg1z8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment