Skip to content

Commit b9bb7ef

Browse files
committed
🐛 fix: 快速排序(#3)
1 parent 4a91da6 commit b9bb7ef

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

docs/algorithm/排序/快速排序.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,14 @@
7070

7171
```js
7272
function quickSort(array, start, end) {
73-
if (end - start < 2) {
73+
if (end - start < 1) {
7474
return;
7575
}
7676
const target = array[start];
7777
let l = start;
7878
let r = end;
7979
while (l < r) {
80-
while (l < r && array[r] > target) {
80+
while (l < r && array[r] >= target) {
8181
r--;
8282
}
8383
array[l] = array[r];

算法分类/排序/快速排序.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,14 @@
6262

6363
```js
6464
function quickSort(array, start, end) {
65-
if (end - start < 2) {
65+
if (end - start < 1) {
6666
return;
6767
}
6868
const target = array[start];
6969
let l = start;
7070
let r = end;
7171
while (l < r) {
72-
while (l < r && array[r] > target) {
72+
while (l < r && array[r] >= target) {
7373
r--;
7474
}
7575
array[l] = array[r];

0 commit comments

Comments
 (0)