def bubble_sort(array)
sorted = false
while sorted
array.each do |i|
if array[i] < array[i+1]
array[i], array[i+1] = array[i+1], array[i]
end
sorted = true
end
end
array
end
p bubble_sort([6, 2, 7, 1, 8, 5])
ZGVmIGJ1YmJsZV9zb3J0KGFycmF5KQoJc29ydGVkID0gZmFsc2UKCXdoaWxlIHNvcnRlZAoJCWFycmF5LmVhY2ggZG8gfGl8CgkJCWlmIGFycmF5W2ldIDwgYXJyYXlbaSsxXQoJCQkJYXJyYXlbaV0sIGFycmF5W2krMV0gPSBhcnJheVtpKzFdLCBhcnJheVtpXQoJCQllbmQKCQkJc29ydGVkID0gdHJ1ZQoJCWVuZAoJZW5kCglhcnJheQplbmQKCnAgYnViYmxlX3NvcnQoWzYsIDIsIDcsIDEsIDgsIDVdKQ==