Created
April 14, 2024 09:58
-
-
Save leomastoras/81fc12ad53dc6fe0d8a4eeb13283f915 to your computer and use it in GitHub Desktop.
Beauty Quicksort
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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