CameraIcon
CameraIcon
SearchIcon
MyQuestionIcon
MyQuestionIcon
1
You visited us 1 times! Enjoying our articles? Unlock Full Access!
Question

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 D 0(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)

flag
Suggest Corrections
thumbs-up
1
Join BYJU'S Learning Program
similar_icon
Related Videos
thumbnail
lock
Wastewater
MATHEMATICS
Watch in App
Join BYJU'S Learning Program
CrossIcon