After you clone this repo you need to move inside merge-sort
directory and run command
npm install
To run
npm install
you must have installed node.js
const testArray: number = [31, 41, 59, 26, 41, 58];
MergeSort.sort(testArray, SortDirection.ASC);
[26, 31, 41, 41, 58, 59]
Static method MergeSort.sort of class MergeSort takes two parametrs:
- elementsList -> it is the list which you want to sort
- direction -> it is optional parameter which you can set as
ASC
orDESC
(ASC is default option)
ASC (Ascending), DESC Descending)
On this graphic you can see how merge-sort algortihm works :
If you do not know what is going on after step three (merge-sort graphic). You can find the answer on the graphic below: