some solutions for projects on odin project

This commit is contained in:
2023-05-24 15:34:43 -05:00
commit 793e2c2c5f
10 changed files with 273 additions and 0 deletions

17
bubble_sort.rb Normal file
View File

@@ -0,0 +1,17 @@
### BUBBLE SORT
def bubble_sort(input_array)
left = 0
until left + 1 == input_array.length
right = left + 1
if input_array[left] > input_array[right]
input_array[left], input_array[right] = input_array[right], input_array[left]
bubble_sort(input_array)
end
left += 1
end
input_array
end
print bubble_sort([4,3,78,2,0,2])