Skip to content

Commit

Permalink
Update recursive insertion sort
Browse files Browse the repository at this point in the history
  • Loading branch information
mgechev committed Oct 7, 2015
1 parent 180ac8e commit de706f1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/sorting/recursive-insertionsort.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@
*/
function recursiveInsertionSort(array, cmp, max) {
cmp = cmp || compare;
if (max <= 0) {
return array;
}
if (max === undefined) {
max = array.length - 1;
}
if (max <= 0) {
return array;
}
recursiveInsertionSort(array, cmp, max - 1);
for (var i = max - 1, current = array[max];
i >= 0 && cmp(current, array[i]) < 0; i -= 1) {
Expand Down

0 comments on commit de706f1

Please sign in to comment.