MergeSort

by mkemac@seznam.cz

Version 1 (October 9, 2018)

Download (163 downloads)

A sample implementation of the MergeSort algorithm.

MergeSort is a divide and conquer sorting algorithm. It first checks if the array contains at most 1 element - that means it's already sorted. Otherwise it splits the array into 2 halves, sorts each one by MergeSort (this makes it a recursive algorithm) and then "merges" the sorted halves.

Merging is done by comparing the first element of each half and removing and placing the smaller one into a new array. Eventually, this will produce a single array whose elements are sorted in an ascending order.

5.0 average rating from 1 reviews

5 stars
1
4 stars
0
3 stars
0
2 stars
0
1 star
0
Reports
0

Rate and review within the app in the Community section.