Merge Sort I
Premium Content - Free Preview
Stable Sort
Like QuickSort, MergeSort runs quickly in O(n log n) time. While Mergesort uses more space and is not usually as fast (in practice) as Quicksort, Mergesort has the benefit of being stable, which means it keeps duplicate elements in the original order that they started with. This is meaningless if the values being sorted is all there is, but usually there's associated data with each element which sometimes needs to be preserved in the original order. For example, if you sort by one value of an item, and then by another value, you may not want the second sort to mess up the order of the first sort.
Stable Sort Example
End of Free Content Preview. Please Sign in or Sign up to buy premium content.
Comments
Panashe Fundira
Jun 19, 11:03 AMI like the quotes :)
Just wish it would run code a little faster though
Learneroo
Jun 19, 11:09 AMThe code usually runs in a few seconds (and doesn't display quotes), but sometimes it needs to fall back to a different server.