Module: sorting/mergesort

Mergesort method which is recursively called for sorting the input array.
Parameters:
Name Type Description
array Array The array which should be sorted.
cmp function Compares two items in an array.
start Number Left side of the subarray.
end Number Right side of the subarray.
Source:
Returns:
Array with sorted subarray.
Type
Array
Example
var array = [2, 4, 1, 5, 6, 7];
var mergeSort =
   require('path-to-algorithms/src/sorting/mergesort').mergeSort;
mergeSort(array); // [1, 2, 4, 5, 6, 7]