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

In quick sort, for sorting n elements , the (n/4)th smallest element is selected as pivot using an 0( n) time algorithm. What is the worst case time complexity of the quick sort?

A
Θ(n log n)
Right on! Give the BNAT exam to get a 100% scholarship for BYJUS courses
B
Θ(n)
No worries! We‘ve got your back. Try BYJU‘S free classes today!
C
Θ(n2 log n)
No worries! We‘ve got your back. Try BYJU‘S free classes today!
D
Θ(n2)
No worries! We‘ve got your back. Try BYJU‘S free classes today!
Open in App
Solution

The correct option is A Θ(n log n)
The relation T(n) = T(n/4) + T(3n/4) + n The pivot element is selected in such a wasy that it will divide the array into 1/4th and 3/4th alwaays solving this relation give Θ(n log n).

flag
Suggest Corrections
thumbs-up
0
Join BYJU'S Learning Program
similar_icon
Related Videos
thumbnail
lock
QUANTITATIVE APTITUDE
Watch in App
Join BYJU'S Learning Program
CrossIcon