Searching, Sorting & Selection

Answer & solution
Official answer: D
Insertion sort may shift Θ(n) elements on each of n insertions, giving Θ(n²). Merge sort uses Θ(n) work across each of Θ(log n) levels, giving Θ(n log n). Quicksort’s most unbalanced partitions give n+(n−1)+...+1=Θ(n²). Thus D.
For reverse-sorted input, insertion sort shifts 1+2+...+(n−1) elements. Merge sort's balanced divide-and-conquer recurrence T(n)=2T(n/2)+Θ(n) yields Θ(n log n) regardless of initial order. Quicksort can repeatedly choose an extreme pivot, leaving subproblems of sizes 0 and n−1, so its recurrence becomes T(n)=T(n−1)+Θ(n). Its average-case or expected randomized Θ(n log n) bound must not be substituted for this requested worst-case bound.