Skip to content

Instantly share code, notes, and snippets.

@ngenator
Created August 8, 2013 00:20
Show Gist options
  • Save ngenator/6180272 to your computer and use it in GitHub Desktop.
Save ngenator/6180272 to your computer and use it in GitHub Desktop.
def bubble_sort(to_sort):
for i in range(len(to_sort) - 1):
for j in range(len(to_sort) - 1):
if to_sort[j+1] < to_sort[j]:
temp = to_sort[j]
to_sort[j] = to_sort[j+1]
to_sort[j+1] = temp
return to_sort
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment