Skip to content

Instantly share code, notes, and snippets.

@YK-Unit
Created September 8, 2023 18:34
Show Gist options
  • Save YK-Unit/d09ba292ad4709ca0c273f9fcb439d67 to your computer and use it in GitHub Desktop.
Save YK-Unit/d09ba292ad4709ca0c273f9fcb439d67 to your computer and use it in GitHub Desktop.
代码的简介
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))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment