Skip to content

Instantly share code, notes, and snippets.

@sarathsp06
Created August 20, 2014 03:54
Show Gist options
  • Save sarathsp06/36cde9dda24e9459f1d0 to your computer and use it in GitHub Desktop.
Save sarathsp06/36cde9dda24e9459f1d0 to your computer and use it in GitHub Desktop.
--sorting algorithm inspired from quick sort in haskel
ksort :: [Int]->[Int]
ksort [] = []
ksort (k:a) = ksort [i|i<-a,i<=k]++(k:(ksort [i|i<-a,i>k]) )
main = do
input <- getLine
let output::[Int]
output = read input
putStrLn (show (ksort output ))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment