MCPcopy Create free account
hub / github.com/PrajaktaSathe/Java / sort

Method sort

Programs/QuickSort.java:25–47  ·  view source on GitHub ↗
(int arr[],int i,int j,int pivot)

Source from the content-addressed store, hash-verified

23 }
24
25 public static int[] sort(int arr[],int i,int j,int pivot){
26 if(j<=pivot || i>=arr.length){
27 return arr;
28 }
29 while(arr[i] < arr[pivot]){
30 i++;
31 }
32 while(arr[j]> arr[pivot]){
33 j--;
34 }
35 if(i<j){
36 int tmp = arr[i];
37 arr[i] = arr[j];
38 arr[j] = tmp;
39 return sort(arr,i,j,pivot);
40 }
41 else{
42 int tmp = arr[pivot];
43 arr[pivot] = arr[j];
44 arr[j] = tmp;
45 return arr;
46 }
47 }
48}

Callers 1

quickSortMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected