Skip to content

Commit de706f1

Browse files
committed
Update recursive insertion sort
1 parent 180ac8e commit de706f1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/sorting/recursive-insertionsort.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@
2727
*/
2828
function recursiveInsertionSort(array, cmp, max) {
2929
cmp = cmp || compare;
30-
if (max <= 0) {
31-
return array;
32-
}
3330
if (max === undefined) {
3431
max = array.length - 1;
3532
}
33+
if (max <= 0) {
34+
return array;
35+
}
3636
recursiveInsertionSort(array, cmp, max - 1);
3737
for (var i = max - 1, current = array[max];
3838
i >= 0 && cmp(current, array[i]) < 0; i -= 1) {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy