Algorithms Insertion Sort suggest change

Haskell Implementation

insertSort :: Ord a => [a] -> [a]
insertSort [] = []
insertSort (x:xs) = insert x (insertSort xs)

insert :: Ord a => a-> [a] -> [a]
insert n [] = [n]
insert n (x:xs) | n <= x    = (n:x:xs)
                | otherwise = x:insert n xs

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents