Sir, did not understand 2nd part- here how we are always choosing middle element as pivote. ??
If we have to sort this list using quick, then we need to proceed as -
6 4 2 1 3 5 7 // here pivote index = 5 (starting with 1)
5 4 2 1 3 6 7 // pivote index = 4
3 4 2 1 5 6 7
3 1 2 4 5 6 7 // pivote = 3
2 1 3 4 5 6 7 // pivote = 2
1 2 3 4 5 6 7
here in all case - quick sort divides the list in two parts where left side list has n-1 elements and right side part has 1 element, so time complexity is O(n^{2}) .
Is this correct sir ??
But I did not understand here that how we will take middle element as pivote..
please clear my doubt sir.