Quick Sort: Presented By: Shivani (B-Tech Cse)
Quick Sort: Presented By: Shivani (B-Tech Cse)
STEP2: if the pivot element is at right , compare it with the element present at left and if the pivot element is present at
left , then compare it with right element.
STEP3: while value at right is greater than pivot move left.
STEP5: if both step 3 and step 4 does not match swap left and right.
Output :
Before sorting array elements are –
24 9 29 14 19 27
After sorting array elements are –
9 14 19 24 27 29
COMPLEXITY :
case Time complexity
Best case O(n*logn)
Average case 0(n*logn)
Worst case O(n^2)