This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.List (isPrefixOf, intercalate) | |
import Data.List.Split | |
import Control.Monad | |
data Tree a = Empty | Node a [Tree a] deriving (Show, Eq) | |
type Zipper a = (Tree a, [Tree a], [Int]) | |
_nthItem :: [a] -> Int -> a | |
_nthItem (x:xs) 1 = x |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from itertools import chain, permutations as perm | |
from operator import ge, gt, le, lt | |
# Algorithm for finding permutations by moving from permutation to next lexicographical permutation | |
# for more info: https://www.nayuki.io/page/next-lexicographical-permutation-algorithm | |
def _suffix(cont, op): | |
""" |