Skip to content

Instantly share code, notes, and snippets.

@samtalks
Last active December 24, 2015 01:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samtalks/6722501 to your computer and use it in GitHub Desktop.
Save samtalks/6722501 to your computer and use it in GitHub Desktop.
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