OA. free
Free
Qualcomm Embedded Systems & Hardware Data Structures & Algorithms Medium

Marker: 1 Which of the below given statements are correct about sorting?

Qualcomm technical mcq question, verified with a worked answer. Free to practise - no sign-up.

Marker: 1**

Which of the below given statements are correct about sorting?

I) Bubble sort requires single additional memory space.

II) Insertion sort is in-place comparison based sorting algorithm.

III) Merge sort is unstable sorting algorithm.

Choose one option.
Show answer & explanation
Answer: C. Only (I) and (II)

Statement I is correct: Bubble sort is an in-place algorithm requiring only O(1) additional space (single temporary variable for swaps). Statement II is correct: Insertion sort is indeed an in-place, comparison-based sorting algorithm. Statement III is incorrect: Merge sort is a stable sorting algorithm because equal elements maintain their relative order during merging. Therefore, only statements (I) and (II) are correct.

Step-by-step Derivation:
Evaluate each statement independently:

Statement I - Bubble Sort Memory: Bubble sort performs adjacent swaps using O(1) extra space (one temporary variable). ✓ CORRECT

Statement II - Insertion Sort: Insertion sort sorts in-place by comparing and shifting elements. It is comparison-based and requires O(1) auxiliary space. ✓ CORRECT

Statement III - Merge Sort Stability: Merge sort is stable because when merging two sorted subarrays, if elements are equal, we pick from the left subarray first, preserving original order. ✗ INCORRECT

Conclusion: Statements I and II are correct → Answer is C