From 92849ff97bf12e0aeea0c4d9ad47f0b09cd377b5 Mon Sep 17 00:00:00 2001 From: Rain120 <1085131904@qq.com> Date: Sun, 30 Jan 2022 12:23:25 +0800 Subject: [PATCH] Update 6.quickSort.md --- 6.quickSort.md | 4 ++++ 1 file changed, 4 insertions(+) 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);