Skip to content

Instantly share code, notes, and snippets.

@barreyro
Created March 26, 2015 03:42
Show Gist options
  • Save barreyro/0a6979b0a7dc012d39e4 to your computer and use it in GitHub Desktop.
Save barreyro/0a6979b0a7dc012d39e4 to your computer and use it in GitHub Desktop.
Algos in Ruby
#Bubble Sort
def bubblesort(list)
0.upto(list.size - 2) do |current|
if list[current] > list[current+1]
list[current], list[current+1] = list[current+1], list[current]
end
end
list
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment