Which of the following is not a stable sorting algorithm?

2024

Which of the following is not a stable sorting algorithm?

  1. A.

    Quick sort

  2. B.

    Cocktail sort

  3. C.

    Bubble sort

  4. D.

    Merge sort

Attempted by 234 students.

Show answer & explanation

Correct answer: A

Explanation: A stable sorting algorithm maintains the relative order of equal elements. Quick sort is not stable because its partitioning step can change the order of equal elements. In contrast, cocktail sort, bubble sort, and merge sort are stable as they preserve the relative order of equal elements during sorting.

Explore the full course: Coding For Placement