can i know what is wrong with this code #include <bits/stdc++.h> int…
- User
can i know what is wrong with this code #include <bits/stdc++.h> int partition(vector &arr){ int pivot = arr[0]; int i=0; int j=arr.size()-1; while(i<=j){ while(arr[pivot]>arr[i]){ i++; } while(arr[pivot]<arr[j]){ j--; } if (i <= j) { swap(arr[i], arr[j]); // Swap elements that are on incorrect sides i++; j--; }
code} if(pivot!=j){ int temp=arr[pivot]; arr[pivot]=arr[j]; arr[j]=arr[pivot]; pivot=j; } return pivot;} vector quick(vector &arr, int s,int e){ if(s<e){ int p = partition(arr); quick(arr,s,p-1); quick(arr,p+1,e); } return arr; } vector quickSort(vector arr) { // Write your code here.
codeint s = 0; int e = arr.size(); return quick(arr,s,e);}
- Assistant