Skip to content

Instantly share code, notes, and snippets.

@duyet
Created April 17, 2014 16:32
Show Gist options
  • Save duyet/10996359 to your computer and use it in GitHub Desktop.
Save duyet/10996359 to your computer and use it in GitHub Desktop.
void quickSort(int left, int right)
{
int i, j, x;
i = left;
j = right;
x = mang[(j + i) / 2];
do {
while (mang[i++] < x); i--;
while (mang[j--] > x); j++;
if (i <= j) swap(mang[i++], mang[j--]);
} while (i <= j);
if (i < right) quickSort(i, right);
if (j > left) quickSort(left, j);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment