Skip to content

Commit 163ec33

Browse files
author
icodeajk
committed
add some notes
1 parent 920ab60 commit 163ec33

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

6.quickSort.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ function partition(arr, left ,right) { // 分区操作
5151
if (arr[i] < arr[pivot]) {
5252
swap(arr, i, index);
5353
index++;
54-
}
54+
}
5555
}
5656
swap(arr, pivot, index - 1);
5757
return index-1;
@@ -62,7 +62,10 @@ function swap(arr, i, j) {
6262
arr[i] = arr[j];
6363
arr[j] = temp;
6464
}
65-
function partition2(arr, low, high) {
65+
66+
67+
/*方法二:记得有三个参数!
68+
function partition2(arr, low, high) {
6669
let pivot = arr[low];
6770
while (low < high) {
6871
while (low < high && arr[high] > pivot) {
@@ -85,7 +88,7 @@ function quickSort2(arr, low, high) {
8588
quickSort2(arr, pivot + 1, high);
8689
}
8790
return arr;
88-
}
91+
} */
8992

9093
```
9194

0 commit comments

Comments
 (0)