挿入ソート
単純なソートアルゴリズム.
計算量は O(n2).
- 空リストは整列されているものとする
- 整列しているリストに対して,1つの要素を正しい場所に挿入する
insert :: Ord a => a -> [a] -> [a] insert x [ ] = [x] insert x (y:ys) | x <= y = x : y : ys | otherwise = y : insert x ys isort :: Ord a => [a] -> [a] isort [ ] = [ ] isort (x:xs) = insert x (isort xs)