Skip to content

Commit 4a67242

Browse files
authored
Add Python
1 parent ae6fad9 commit 4a67242

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

1.bubbleSort.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,16 @@ function bubbleSort(arr) {
4747
}
4848
return arr;
4949
}
50-
```
50+
```
51+
52+
53+
## 5. Python 代码实现
54+
55+
```python
56+
def bubbleSort(arr):
57+
for i in range(1, len(arr)):
58+
for j in range(0, len(arr)-i):
59+
if arr[j] > arr[j+1]:
60+
arr[j], arr[j + 1] = arr[j + 1], arr[j]
61+
return arr
62+
```

0 commit comments

Comments
 (0)