Prove expected QuickSort comparisons is O(n log n)
Analyze the prove expected quicksort comparisons is o(n log n).
Examples
Input: "test_input_1"
Output: "output_1"
Input: "test_input_2"
Output: "output_2"
Hints
Recall that the expected number of comparisons in quicksort can be modeled using the concept of linearity of expectation and indicator random variables for pairs of elements.
Consider the probability that any two distinct elements are compared during the execution of quicksort, and how this probability changes based on their positions in the pivot selection process.
Use the fact that the expected number of comparisons is the sum over all pairs of elements of the probability that they are compared, then apply probabilistic bounds or recurrence relations to show this sum is o(n log n).
Prove expected QuickSort comparisons is O(n log n)
Analyze the prove expected quicksort comparisons is o(n log n).