inserts :: a -> [a] -> [[a]]
inserts x [] = [[x]]
inserts x (y:ys) = (x:y:ys) : map (y:) (inserts x ys)
perms1 [] = [[]]
perms1 (x:[]) = [[x]]
perms1 (x:xs) = [zs | ys <- perms1 xs, zs <- inserts x ys]
Created
November 13, 2020 04:41
-
-
Save shubhamkumar13/24cafe2731f8a14e71c17d86a8d1325a to your computer and use it in GitHub Desktop.
corrections in algorithms design in haskell
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment