Skip to content

Instantly share code, notes, and snippets.

@shigemk2
Created October 25, 2014 12:35
Show Gist options
  • Save shigemk2/77afbb6ed29c2580c003 to your computer and use it in GitHub Desktop.
Save shigemk2/77afbb6ed29c2580c003 to your computer and use it in GitHub Desktop.
import Debug.Trace
bubble [x] = [x]
bubble (x:xs)
| y < x = y : bubble (x:ys)
| otherwise = x : bubble (y:ys)
where
(y:ys) = bubble xs
main = do
print $ bubble [13,55,98,1,52,97,16,99,45,30,82,22,77,91,70,59,54,7,96,20,29,79,0,49,85,58,36,33,32,74,64,92,76,34,37,56,5,18,38,40,78,48,2,81,94,65,24,69,8,21,12,66,73,25,26,51,84,31,3,27,46,10,83,87,63,11,47,6,50,35,75,23,19,44,89,86,41,42,43,17,60,71,62,57,15,80,14,100,4,88,68,28,72,95,93,67,90,61,39,9]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment