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 7834c26

Browse files
Add Python
1 parent 4a67242 commit 7834c26

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

‎2.selectionSort.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,15 @@ function selectionSort(arr) {
3636
}
3737
return arr;
3838
}
39-
```
39+
```
40+
41+
## 4. Python 代码实现
42+
43+
```python
44+
def selectionSort(arr):
45+
for i in range(len(arr)-1):
46+
for j in range(i+1, len(arr)):
47+
if arr[j] < arr[i]:
48+
arr[i], arr[j] = arr[j], arr[i]
49+
return arr
50+
```

0 commit comments

Comments
(0)

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