Created
September 8, 2023 18:53
-
-
Save YK-Unit/0afeba901823eedeb5a607c2168cae8c 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
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): | |
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): | |
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