Last active

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

buddle_sort

View sort.rb
1 2 3 4 5 6 7 8 9 10 11 12
def bubble_sort(list)
(list.length() - 1).downto(0).each { |bubble_to_index|
(0..(bubble_to_index - 1)).each { |bubbling_index|
if list[bubbling_index] > list[bubbling_index + 1]
tmp = list[bubbling_index]
list[bubbling_index] = list[bubbling_index + 1]
list[bubbling_index + 1] = tmp
end
}
}
list
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.