Last active
December 24, 2015 01:19
-
-
Save samtalks/6722501 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
songs = [ | |
"The Magnetic Fields - 69 Love Songs - Parades Go By", | |
"The Magnetic Fields - Get Lost - Smoke and Mirrors", | |
"Neutral Milk Hotel - In An Aeroplane Over the Sea - Holland 1945", | |
"The Magnetic Fields - Get Lost - You, Me, and the Moon", | |
"The Magnetic Fields - 69 Love Songs - The Book of Love", | |
"Neutral Milk Hotel - In An Aeroplane Over the Sea - The King of Carrot Flowers" | |
] | |
swapped = true | |
while swapped do | |
swapped = false | |
i = 0 | |
while i < songs.size-1 do | |
if songs[i] > songs[i+1] | |
songs[i], songs[i+1] = songs[i+1], songs[i] | |
swapped = true | |
end | |
i += 1 | |
end | |
end | |
puts songs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment