Merge sort: Difference between revisions

From Wiki :-)
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
Merge sort is a divide-and-conquer recursive sorting algorithm.
Merge sort is a divide-and-conquer recursive sorting algorithm.


First, the algorithm divides the array to sort into to sub-arrays until the sub-arrays contain only one element. Then, the each pair of sub-arrays are merged in the correct order. To merge the sub-arrays, the algorithm go through both sub-arrays in the same time.
First, the algorithm divides the array to sort into two sub-arrays until the sub-arrays contain only one element. Then, the each pair of sub-arrays are merged in the correct order. To merge the sub-arrays, the algorithm go through both sub-arrays in the same time.


== Resources ==
== Resources ==

Revision as of 03:23, 22 October 2020

Merge sort is a divide-and-conquer recursive sorting algorithm.

First, the algorithm divides the array to sort into two sub-arrays until the sub-arrays contain only one element. Then, the each pair of sub-arrays are merged in the correct order. To merge the sub-arrays, the algorithm go through both sub-arrays in the same time.

Resources

https://en.wikipedia.org/wiki/Merge_sort