Which of the following is not a stable sorting algorithm?
2024
Which of the following is not a stable sorting algorithm?
- A.
Quick sort
- B.
Cocktail sort
- C.
Bubble sort
- 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.