Skip to content

Instantly share code, notes, and snippets.

@YK-Unit
Created September 8, 2023 18:03
Show Gist options
  • Save YK-Unit/fd6b1d518cb2fa822c0e9fae9a03f23f to your computer and use it in GitHub Desktop.
Save YK-Unit/fd6b1d518cb2fa822c0e9fae9a03f23f to your computer and use it in GitHub Desktop.
gist example
```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]
return arr
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment