Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void quickSort(int arr[], int from, int to){
- int i = from, j = to, pivot = arr[from], pom;
- if (to - from>0){
- while (i < j){
- while (arr[i] <= pivot)
- i++;
- while (arr[j] > pivot)
- j--;
- if (i < j){
- pom = arr[i];
- arr[i] = arr[j];
- arr[j] = pom;
- }
- }
- pom = arr[from];
- arr[from] = arr[j];
- arr[j] = pom;
- quickSort(arr, from, j - 1);
- quickSort(arr, i, to);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement