Which of the following classic sorting algorithms performs exactly the same number of comparisons regardless of whether the input array is already sorted, reverse sorted, or randomly ordered?
C
Step-by-Step Solution
Key idea: This is a comparative operation count question, testing knowledge of which algorithms are "adaptive" versus "non-adaptive" in their comparison behavior.
Step 1: Insertion Sort is adaptive; it makes comparisons on a sorted array but on a reverse sorted array.
Step 2: Bubble Sort with an early termination flag is adaptive; it makes comparisons on a sorted array.
Step 3: Quick Sort's comparison count heavily depends on pivot selection and the initial order of the array.
Step 4: Selection Sort always scans the entire unsorted portion to find the minimum element, performing exactly comparisons in all cases.
Answer: C