From 3e1e38338682ad3007b9b6abfd3f861d7ecd9f7c Mon Sep 17 00:00:00 2001 From: Isabelle Viktoria Maciohsek Date: Tue, 29 Dec 2020 13:04:24 +0200 Subject: [PATCH] Update selectionSort.md --- snippets/selectionSort.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/snippets/selectionSort.md b/snippets/selectionSort.md index 1ac735fc8..3fcd2d0ce 100644 --- a/snippets/selectionSort.md +++ b/snippets/selectionSort.md @@ -12,14 +12,12 @@ Sorts an array of numbers, using the selection sort algorithm. ```js const selectionSort = arr => { const a = [...arr]; - for (let i = 0; i < a.length; i++) { const min = a .slice(i + 1) .reduce((acc, val, j) => (val < a[acc] ? j + i + 1 : acc), i); if (min !== i) [a[i], a[min]] = [a[min], a[i]]; } - return a; }; ```