Various Merge Sort implimentations in pure javascript.
The above files use different approaches to perform a merge sort.
- Splits the input, uses recursive concatination and then sorts
- Does not store in extra Arrays
- Moderate space complexity
- Moderate - High computational complexity
- Uses index rather than splitting the array
- Progressive with no returns (Modifies the input array itself)
- Very Low space complexity (Less Memory)
- Moderate computational complexity
- Simple
- Uses 3 Arrays - Left Sub-Array, Right Sub-Array, Merged
- High space complexity (Uses more memory)
- Very Low computational complexity (Good performance)
When using mergesort-recursive-concat.js or mergesort-3-arrays.js
var sortedArray = mergeSort(unsortedArray);
When using mergesort-indexed.js, the input array would be modified
mergeSort(unsortedArray);
Licenced under GNU GENERAL PUBLIC LICENSE v3.0. It is free to copy, use and distribute.