This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Markdown代码块中的所有内容 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
markdown的代码块内容 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<markdown-code-block>Markdown代码块中的所有内容</markdown-code-block> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```python | |
def bubble_sort(arr): | |
n = len(arr) | |
# 遍历所有数组元素 | |
for i in range(n): | |
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```python | |
def bubble_sort(arr): | |
n = len(arr) | |
# 遍历所有数组元素 | |
for i in range(n): | |
for j in range(0, n-i-1): | |
if arr[j] > arr[j+1]: | |
arr[j], arr[j+1] = arr[j+1], arr[j] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```python | |
def bubble_sort(arr): | |
n = len(arr) | |
# 遍历所有数组元素 | |
for i in range(n): | |
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
A |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
A |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n = len(arr) | |
for i in range(n): | |
for j in range(0, n-i-1): | |
if arr[j] > arr[j+1]: | |
arr[j], arr[j+1] = arr[j+1], arr[j] | |
return arr | |
arr = [64, 34, 25, 12, 22, 11, 90] | |
print(bubble_sort(arr)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def bubble_sort(arr): | |
n = len(arr) | |
for i in range(n): | |
for j in range(0,n-i-1): | |
if arr[j] > arr[j+1]: | |
arr[j],arr[j+1] = arr[j+1],arr[j] | |
return arr | |
def bubble_sort(arr): | |
n = len(arr) | |
for i in range(n): |