Stable vs unstable

Report a typo

Remember that there are two different types of sorting algorithms: stable and unstable ones. We want to sort the list [[3, 9], [4, 1], [4, 6], [4, 0], [3, 11], [1, 2], [6, 5]] in ascending order by the first integer. We had it sorted by both. Which was which?

Match the items from left and right columns
Stable algorithm
Unstable algorithm
[[1, 2], [3, 9], [3, 11], [4, 0], [4, 1], [4, 6], [6, 5]]
[[1, 2], [3, 9], [3, 11], [4, 1], [4, 6], [4, 0], [6, 5]]
___

Create a free account to access the full topic