Created
August 26, 2020 12:35
-
-
Save zhanglintc/e51bd89f9fe6fc507982f59f1d693ea8 to your computer and use it in GitHub Desktop.
bubble sort
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(a): | |
for i in range(len(a)): | |
for j in range(len(a) - i - 1): | |
if a[j] > a[j + 1]: | |
a[j], a[j + 1] = a[j + 1], a[j] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment