It should be O(nlogn) in worst case because, selecting median as pivot means it will be always placed at the middle after applying partition algorithm.

1 vote

Consider a scenario of modified quick sort, where we have given an input sorted array A[1 .. . n], all elements of array are distinct and n >=3. Pivot is the median of set of 3 elements [First element, middle element, and last element]. What will be worst case time complexity of modified quick sort?

a.O($n^{2}$)

b.O(nlogn)

c.O($n^{2}$logn)

d.O(nloglogn)

a.O($n^{2}$)

b.O(nlogn)

c.O($n^{2}$logn)

d.O(nloglogn)