Skip to content

Instantly share code, notes, and snippets.

@MelanieS
Created October 21, 2012 01:16
Show Gist options
  • Save MelanieS/3925381 to your computer and use it in GitHub Desktop.
Save MelanieS/3925381 to your computer and use it in GitHub Desktop.
A bad sorting algorithm
unsorted_array = [5, 2, 8, 0, 9, 3, 1]
sorted_array = []
count = 0
while sorted_array.count != unsorted_array.count
unsorted_array.each do |i|
if i == count
sorted_array << i
end
end
count += 1
end
puts sorted_array.to_s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment