Merge sort (also commonly spelled mergesort) is an efficient, general-purpose, comparison-based sorting algorithm. Most implementations
produce a stable sort, which means that the implementation preserves the input order of equal elements in
the sorted output. Mergesort is a divide and conquer algorithm.
Conceptually, a merge sort works as follows:
-
Divide the unsorted list into n sublists, each containing 1 element (a list of 1 element is considered sorted).
- Repeatedly merge sublists to produce new sorted sublists until there is only 1 sublist remaining.
This will be the sorted list.
|
|
|