Which of the following is stable sort?

2021

Which of the following is stable sort?

  1. A.

    Selection sort

  2. B.

    Quick sort

  3. C.

    Heap sort

  4. D.

    Merge sort

Attempted by 607 students.

Show answer & explanation

Correct answer: D

Merge sort is a stable sorting algorithm because it preserves the relative order of equal elements during the merge process. When merging two sorted subarrays, if two elements are equal, the element from the left subarray is placed first. This ensures that the original order of equal elements is maintained. In contrast, selection sort, quick sort, and heap sort are not stable because they may swap or reorder equal elements during their operations, disrupting their original sequence.

Explore the full course: Up Lt Grade Assistant Teacher 2025