fork(1) download
  1. void partition(int * & l, int * & r) {
  2. int * mid = l + rnd((int) (r - l));
  3. swap(*mid, *l);
  4. mid = l++;
  5. int * j = l;
  6. while (j < r) {
  7. if (*j < *mid) {
  8. swap(*(j++), *(l++));
  9. } else if (*j > *mid) {
  10. swap(*j, *(--r));
  11. } else ++j;
  12. }
  13. swap(*mid, *(l - 1));
  14. }
  15.  
  16. void quick_sort(int * l, int * r) {
  17. int * i = l, * j = r;
  18. partition(i, j);
  19. if (l < i - 1) {
  20. quick_sort(l, i);
  21. }
  22. if (j < r - 1) {
  23. quick_sort(j, r);
  24. }
  25. }
  26.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘void partition(int*&, int*&)’:
prog.cpp:2:36: error: ‘rnd’ was not declared in this scope
   int * mid = l + rnd((int) (r - l));
                                    ^
prog.cpp:3:16: error: ‘swap’ was not declared in this scope
   swap(*mid, *l);
                ^
stdout
Standard output is empty