Practice free →
HomeGATE CSEcomputerscienceAlgorithms › Randomised quick sort improves on plain quick so…

Randomised quick sort improves on plain quick sort because

Ait eliminates the worst case entirely; every run is Θ(n log n)
Bit switches to merge sort when the input is sorted
Cit sorts in O(n) on any input
Da random pivot makes bad splits unlikely, giving expected Θ(n log n)
Answer & Solution
Correct answer: D. a random pivot makes bad splits unlikely, giving expected Θ(n log n)
Randomisation makes the algorithm's running time depend on its own coin flips, not on the input. Sorted inputs no longer trigger the worst case. Worst case is still O(n²) in theory but astronomically unlikely. Switching to merge sort is a different hybrid (introsort); plain randomised quick sort cannot beat the Ω(n log n) comparison bound.
Solve this in the app — GATE CSE practice & 24k+ MCQs →
Related questions