Anonymous user
Sorting algorithms/Quicksort: Difference between revisions
m
→{{header|C}}: Remove the comment about the bug in the prior version. Move swap and increment to their own lines.
Walterpachl (talk | contribs) m (→{{header|ooRexx}}: correct output tag) |
m (→{{header|C}}: Remove the comment about the bug in the prior version. Move swap and increment to their own lines.) |
||
Line 651:
if (*l < p) {
l++;
continue;▼
}
else if (*r > p) {
int t = *l;▼
*l = *r;
*r = t;
l++;
r--;
}
▲ int t = *l;
▲ *l++ = *r;
▲ *r-- = t;
}
quick_sort(a, r - a + 1);
quick_sort(l, a + n - l);
}
int main () {
int a[] = {4, 65, 2, -31, 0, 99, 2, 83, 782, 1};
|