Search/Sorts algoruthms : remove live code & console.log, leave examples as comments.

This commit is contained in:
Eric Lavault
2021-10-11 12:29:03 +02:00
parent 8a7be96c9d
commit 74f296578a
22 changed files with 121 additions and 197 deletions

View File

@@ -8,7 +8,7 @@
*from the unsorted subarray is picked and moved to the sorted subarray.
*/
const selectionSort = (list) => {
export const selectionSort = (list) => {
if (!Array.isArray(list)) {
throw new TypeError('Given input is not an array')
}
@@ -33,18 +33,3 @@ const selectionSort = (list) => {
}
return items
}
/* Implementation of Selection Sort
(() => {
let array = [5, 6, 7, 8, 1, 2, 12, 14]
// Array before Sort
console.log(array)
array = selectionSort(array)
// Array after sort
console.log(array)
})()
*/
export { selectionSort }