diff --git a/6.quickSort.md b/6.quickSort.md index 28ad477..e04c952 100644 --- a/6.quickSort.md +++ b/6.quickSort.md @@ -79,6 +79,10 @@ function partition2(arr, low, high) { } function quickSort2(arr, low, high) { + const len = arr.length; + low = typeof low != 'number' ? 0 : low, + high = typeof high != 'number' ? len - 1 : high; + if (low < high) { let pivot = partition2(arr, low, high); quickSort2(arr, low, pivot - 1);