Step 1: Understand what makes this the expected time, not the worst case.
The array is randomly ordered, and the pivot is always taken as the first element of whatever subarray we are currently sorting. Because the input order is random, we cannot assume the pivot always lands in a fixed spot like the smallest or the middle element, instead, the pivot could equally likely end up being the smallest, the largest, or anything in between, once we finish partitioning.
Step 2: Work out the distribution of the pivot's final rank.
After partitioning around the pivot, suppose \(k\) elements end up smaller than the pivot (forming the left subarray of size \(k\)) and the remaining \(n-1-k\) elements end up larger (forming the right subarray of size \(n-1-k\)). Since the array is randomly ordered, the first element is equally likely to be any of the \(n\) elements in terms of rank, so \(k\) is equally likely to be any value from 0 up to \(n-1\), each with probability \(\frac{1}{n}\).
Step 3: Build the recurrence by averaging over all possible splits.
Given a particular value of \(k\), the cost is \(T(k) + T(n-1-k)\) for sorting the two resulting parts, plus \(O(n)\) for the partition step itself (given as linear in the current subarray size). Since every split value \(k\) from 0 to \(n-1\) is equally likely, the expected time is the average of \(T(k) + T(n-1-k)\) over all these \(n\) equally likely outcomes, plus the partition cost:
\[ T(n) = \frac{1}{n}\sum_{k=0}^{n-1}\left[T(k) + T(n-k-1)\right] + O(n) \]
This matches option (D) exactly.
Step 4: Why the other options fail.
Option (A), \(T(n) = T(1) + T(n-1) + O(n)\), describes the worst case, where the pivot always ends up smallest or largest, giving one part of size 1 every single time, this happens only for already sorted or specially adversarial inputs, not for a randomly ordered array. Options (B) and (C) both assume a single fixed split ratio, one quarter-three quarters, or half-half, happens on every single call. But with a random array and a first-element pivot, the actual split ratio varies from call to call, we cannot pin it to one fixed ratio, we must average across every possible ratio, which is exactly what option (D) does.
Step 5: Final Answer.
The correct recurrence for the expected time is option (D).
\[ \boxed{T(n) = \frac{1}{n}\sum_{k=0}^{n-1}\left[T(k)+T(n-k-1)\right] + O(n)} \]