Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- orderedInsert :: (Ord a) => [a] -> a -> [a]
- orderedInsert [] x = [x]
- orderedInsert (x : xs) y = if y <= x then y : x : xs else x : orderedInsert xs y
- insertionSort :: (Ord a) => [a] -> [a]
- insertionSort = foldl orderedInsert []
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement