Last active
December 29, 2020 15:04
-
-
Save devansh42/bb690995e36d7c9b3cbd46c8a24713e6 to your computer and use it in GitHub Desktop.
Imperative algorithm of bubble sort in python
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 imperative_bubble_sort(ar): | |
for i in range(len(ar)): | |
for j in range(len(ar)-1-i): | |
if ar[j]>ar[j+1]: | |
ar[j],ar[j+1] = ar[j+1],ar[j] | |
return ar |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment