Created
March 23, 2025 19:18
-
-
Save Carmen195/f725b8fe6226cbf36c133b27c294f682 to your computer and use it in GitHub Desktop.
Nombres misteriosos buble 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 b(l): | |
n = len(l) | |
for i in range(n): | |
for j in range(0, n-i-1): | |
if l[j] > l[j+1] : | |
l[j], l[j+1] = l[j+1], l[j] | |
# Ejemplo de uso | |
l = [64, 34, 25, 12, 22, 11, 90] | |
b(l) | |
print ("Lista ordenada:") | |
for i in range(len(l)): | |
print ("%d" % l[i]), |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment