nbsp insert print brush div pre clas 排序 ask
- insert a [] = [a]
- insert a (x1:xs)
- | x1 > a = a:x1:xs
- | otherwise = x1:insert a xs
- sort [] = []
- sort (a1:ax) = insert a1 (sort ax)
- main = do
- print $ sort [10,2,432,5436]
插入排序 (haskell)
来源: http://www.bubuko.com/infodetail-2398293.html