After you clone this repo you need to move inside insertion-sort
directory and run command
npm install
To run
npm install
you must have installed node.js
const testArray: number = [2, 5, -12, 91, 5];
insertionSort(testArray, SortDirection.DESC);
[-12, 2, 5, 5, 91]
insertionSort method 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 insertion-sort algortihm works :