Open In App

GATE | GATE-CS-2001 | Question 14

Randomized quicksort is an extension of quicksort where the pivot is chosen randomly. What is the worst case complexity of sorting n numbers using randomized quicksort?

(A)



O(n)

(B)



O(n*log(n))

(C)

O(n2)

(D)

O(n!)

Answer: (C)
Explanation:

If all elements of the given array are same then that is the worst case for the randomised quicksort. And time complexity of worst case of quicksort is O(n²) that is proven already. So, option (C) is correct.

Quiz of this Question
Please comment below if you find anything wrong in the above post

Article Tags :