Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 4a67242

Browse files
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)

AltStyle によって変換されたページ (->オリジナル) /