MCPcopy Create free account
hub / github.com/chaharnishant11/CodeIn10DSA / partition

Function partition

Sorting/Homework/quickSort.cpp:33–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31}
32
33int partition (int arr[], int start, int end)
34{
35 // Your code here
36 int pivot = arr[end];
37 int i = start-1;
38 for(int j=start;j<end;j++){
39 if(arr[j]<pivot){
40 i++;
41 swap(arr,i,j);
42 }
43 }
44 swap(arr,i+1,end);
45 return i+1;
46}
47
48// { Driver Code Starts.
49int main()

Callers 1

quickSortFunction · 0.70

Calls 1

swapFunction · 0.70

Tested by

no test coverage detected