Give recurrence for quick sort algorithm runtime when it sorts n-randomly sorted
integers. Derive the closed form solution using sum-method.
The concept of Quick short algorithm is based on the divide and conquer. In which it divides the array into the smaller parts and then it shorts the array elements.
The pseudo-code is given below:
function partFunc(left, right, pivot)
leftPointer = left
rightPointer = right - 1
while True do
while A[++leftPointer] < pivot do
end while
while rightPointer > 0 && A[--rightPointer] > pivot do
end while
if leftPointer >= rightPointer
break
else
swap leftPointer,rightPointer
end if
end while
swap leftPointer,right
return leftPointer
end function
Comments
Leave a comment