You have an array of n elements. Suppose you implement quicksort by always choosing the central element of the array as the pivot. Then the tightest upper bound for the worst case performance is
A
0(n3)
No worries! We‘ve got your back. Try BYJU‘S free classes today!
B
0(nlogn)
No worries! We‘ve got your back. Try BYJU‘S free classes today!
C
Θ(nlogn)
No worries! We‘ve got your back. Try BYJU‘S free classes today!
D
0(n2)
Right on! Give the BNAT exam to get a 100% scholarship for BYJUS courses
Open in App
Solution
The correct option is D0(n2) Choosing the central element (middle) as the pivot always can not make the partition into equal parts. ∴ The worst case time complexity
= 0(n2)