# Pastebin KuptrFM8 def bubblesort(array) array.each_index {|i| (array.size-1).downto(i) do |j| if array[j - 1] > array[j] { temp = array[j] array[j] = array[j - 1] array[j - 1] = temp } end } end bubblesort([1,5,8,3,9,2,5])