Skip to content

kanow-algorithms/selection-sort

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

selection-sort

Instalation

After you clone this repo you need to move inside selection-sort directory and run command

npm install

To run npm install you must have installed node.js

Description

Example input :

const testArray: number = [2, 5, -12, 91, 5];
selectionSort(testArray, SortDirection.DESC);

Output of example input :

[-12, 2, 5, 5, 91]

selectionSort 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 or DESC (ASC is default option)

ASC (Ascending), DESC Descending)

How it works

On this graphic you can see how selection-sort algortihm works :

InsertionSort

Releases

No releases published

Packages

No packages published