let instance = Mergesort(),
inputArray = [{value:10},{value:1},{value:5}],
compare = (a, b) => a.value - b.value;
instance(inputArray, compare); //[{value:1}, ...]
Parameters:
Name | Type | Description |
---|---|---|
ArrayToBeSorted |
Array | Input array to be sorted |
Compare |
function | compare function, same as in here |
- Source:
Returns:
input array
- Type
- Array