Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sp :: [Integer] -> [Integer]
- sp (x:y:ys)
- | x > y = y : sp (x : ys)
- | otherwise = x : sp (y : ys)
- sp xs = xs
- srt :: [Integer] -> [Integer]
- srt xs
- | xs == sp xs = xs
- | otherwise = srt $ sp xs
- main :: IO ()
- main = print $ srt [500,499 .. 0]
- -- real 0m0,021s
- -- user 0m0,017s
- -- sys 0m0,004s
Add Comment
Please, Sign In to add comment