Skip to content

Commit b8c5e86

Browse files
AnHongpenghustcc
AnHongpeng
authored andcommitted
fix bubbleSort.md (#9)
1 parent 2032ebd commit b8c5e86

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

1.bubbleSort.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
```js
3737
function bubbleSort(arr) {
3838
var len = arr.length;
39-
for (var i = 0; i < len; i++) {
39+
for (var i = 0; i < len - 1; i++) {
4040
for (var j = 0; j < len - 1 - i; j++) {
4141
if (arr[j] > arr[j+1]) { // 相邻元素两两对比
4242
var temp = arr[j+1]; // 元素交换

0 commit comments

Comments
 (0)