Let denote the expected time to sort the array. Assume that the time to partition is linear in the size of the current subarray.
Which of the following recurrence relations correctly represents in this scenario?
D
Step-by-Step Solution
Key idea: This is an expected recurrence analysis problem for Quicksort, recognizable by the phrases "expected time", "randomly ordered elements", and a fixed pivot position (first element).
Step 1: Understand the pivot selection dynamics.
Although the pivot is deterministically chosen as the first element of the subarray, the array itself is randomly ordered. This means the first element is equally likely to be the st, nd, ..., or -th smallest element in the subarray.
Step 2: Determine the subproblem sizes.
Let the rank of the chosen pivot be (where ranges from to ).
- The left subarray will contain the elements smaller than the pivot.
- The right subarray will contain the remaining elements larger than the pivot.
Step 3: Formulate the expected time recurrence.
Since each possible rank occurs with a uniform probability of , the expected time is the average of the expected times of all possible splits, plus the time required for the partitioning step itself.
Mathematically, this is expressed as:
Step 4: Match with the given options.
This derived formula exactly matches the fourth option.
Answer: D