Question: A sorting algorithm is said to be stable if the ordering of equal elements doesn't change. More formally, a sorting algorithm is stable if, for
A sorting algorithm is said to be stable if the ordering of equal elements doesn't change. More formally, a sorting algorithm is stable if, for any two elements i and j with equal values, i precedes j after the sorting if and only if i precedes j before the sorting.
a) Show that Merge Sort is stable.
b) Show the Quick Sort is not stable.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
