From 3b4f458782c456f0629ff2fbe5c7b411afd2e6a7 Mon Sep 17 00:00:00 2001 From: Isabelle Viktoria Maciohsek Date: Tue, 29 Dec 2020 13:03:18 +0200 Subject: [PATCH] Update quickSort.md --- snippets/quickSort.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/snippets/quickSort.md b/snippets/quickSort.md index c6dc6c4fe..fe419e5a9 100644 --- a/snippets/quickSort.md +++ b/snippets/quickSort.md @@ -15,9 +15,7 @@ Sorts an array of numbers, using the quicksort algorithm. ```js const quickSort = arr => { const a = [...arr]; - if (a.length < 2) return a; - const pivotIndex = Math.floor(arr.length / 2); const pivot = a[pivotIndex]; const [lo, hi] = a.reduce( @@ -31,7 +29,6 @@ const quickSort = arr => { }, [[], []] ); - return [...quickSort(lo), pivot, ...quickSort(hi)]; }; ```