Stable sorting algorithms maintain the relative order of records with equal keys (i.e. values). That is, a sorting algorithm is stable if whenever there are two records R and S with the same key (i.e. value) and with R appearing before S' in the original list, R will appear before S' in the sorted list. Consider Insertion Sort, Merge Sort, Quick Sort. Which of these is not a stable sorting algorithm? Justify your answer.

icon
Related questions
Question
1. Stable sorting algorithms maintain the relative order of records with equal keys (i.e. values). That is, a
sorting algorithm is stable if whenever there are two records R and S with the same key (i.e. value) and
with R appearing before S in the original list, R will appear before S in the sorted list.
Consider Insertion Sort, Merge Sort, Quick Sort. Which of these is not a stable sorting algorithm?
Justify your answer.
Transcribed Image Text:1. Stable sorting algorithms maintain the relative order of records with equal keys (i.e. values). That is, a sorting algorithm is stable if whenever there are two records R and S with the same key (i.e. value) and with R appearing before S in the original list, R will appear before S in the sorted list. Consider Insertion Sort, Merge Sort, Quick Sort. Which of these is not a stable sorting algorithm? Justify your answer.
Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer