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