What is the worst-case time complexity of quicksort?
Correct answer
B. O(n²)
18 views
B. O(n²)
18 views
When the pivot is always the smallest or largest element, as with an already sorted array and a naive pivot, partitions are unbalanced and quicksort runs in O(n²). Its average case is O(n log n).
Asked in: GATE CS, NTS, Technical Interviews
Not sure why the answer is B? Ask here and get an explanation.