Skip to content

Commit afe97c3

Browse files
authored
Update 6.quickSort.md
1 parent 46c8d06 commit afe97c3

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

6.quickSort.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ function partition2(arr, low, high) {
9797
}
9898

9999
function quickSort2(arr, low, high) {
100+
const len = arr.length;
101+
low = typeof low != 'number' ? 0 : low,
102+
high = typeof high != 'number' ? len - 1 : high;
103+
100104
if (low < high) {
101105
let pivot = partition2(arr, low, high);
102106
quickSort2(arr, low, pivot - 1);

0 commit comments

Comments
 (0)