Data Structures & AlgorithmsVery hardICPC regional · randomised algorithms

Problem: What is the expected number of comparisons of randomised quicksort on n distinct elements?

  1. A. n log n exactly
  2. B. n^2 / 2
  3. C. n
  4. D. About 2n ln n

Correct answer: D. About 2n ln n

The expected comparison count is 2(n+1)H_n - 4n, which is about 2n ln n.

More Coding Interview Problems questions

Exams that ask this topic