1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| void QuickSort(int array[], int L, int R){ if(L < R) { int left = L, right = R; int compara = array[left]; while (left < right) { while (left < right && array[right] > compara) right--; if (left < right) { array[left] = array[right]; left++; } while (left < right && array[left] < compara) left++;
if (left < right) { array[right] = array[left]; right--; } } array[left] = compara;
QuickSort(array, L, right -1); QuickSort(array, left+1, R); } }
|