Content deleted Content added
→Application: no reason for this image to have such nonstandard formatting |
|||
Line 2:
== Application ==
The merge algorithm plays a critical role in the [[merge sort]] algorithm, a [[comparison sort|comparison-based sorting algorithm]]. Conceptually, merge sort algorithm consists of two steps:
Line 8 ⟶ 9:
The merge algorithm is used repeatedly in the merge sort algorithm.
▲[[File:Merge sort algorithm diagram.svg|centre|thumb|An example for merge sort]]
An example merge sort is given above. It starts with an unsorted array of 7 integers. The array is divided into 7 partitions; each partition contains 1 element and is sorted. The sorted partitions are then merged to produce larger, sorted, partitions, until 1 partition, the sorted array, is left.
|