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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!