Advanced
Discrete Mathematics & Math
Q88 / 100
What is the probabilistic analysis of quicksort?
Correct! Well done.
Incorrect.
The correct answer is B) With random pivot selection, the expected number of comparisons is 2n ln n ≈ 1.386 n log₂ n, analyzed using indicator random variables and linearity of expectation
B
Correct Answer
With random pivot selection, the expected number of comparisons is 2n ln n ≈ 1.386 n log₂ n, analyzed using indicator random variables and linearity of expectation
Explanation
E[comparisons] = Σᵢ<ⱼ 2/(j-i+1) = 2n(H_n - 1) ≈ 2n ln n. Elements i,j compare iff one of them is the first pivot chosen from {i,...,j}. This linearity-of-expectation proof is elegant and standard.
Progress
88/100