MergeSort

by mkemac@seznam.cz

Version 1 (October 9, 2018)

Download (101 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.

4.0 average rating from 1 reviews

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

Reviews and ratings can be submitted in the app.