Practice free →
HomeGATE CSEcomputerscienceAlgorithms › Compared to merge sort, standard quick sort is

Compared to merge sort, standard quick sort is

Ain-place (O(log n) stack), but NOT stable
Bstable but uses O(n) extra memory
Cstable AND in-place; merge sort is neither
Dunstable and uses O(n) extra memory
Answer & Solution
Correct answer: A. in-place (O(log n) stack), but NOT stable
Quick sort needs only the recursion stack (O(log n) on balanced splits), making it in-place compared to merge sort's O(n) aux array. But its long-range swaps during partition can reorder equal-keyed elements, so it is NOT stable. Merge sort is stable but needs O(n) extra memory. The two algorithms trade memory for stability.
Solve this in the app — GATE CSE practice & 24k+ MCQs →
Related questions