hgeometry-combinatorial-0.10.0.0: Data structures, and Data types.

Safe HaskellNone
LanguageHaskell2010

Algorithms.DivideAndConquer

Synopsis

Documentation

divideAndConquer :: Monoid s => (a -> s) -> [a] -> s Source #

Divide and conquer for

divideAndConquer1 :: Semigroup s => (a -> s) -> NonEmpty a -> s Source #

Divide and conquer strategy

the running time is: O(n*L) + T(n) = 2T(n/2) + M(n)

where M(n) is the time corresponding to the semigroup operation of s

divideAndConquer1With :: (s -> s -> s) -> (a -> s) -> NonEmpty a -> s Source #

Divide and conquer strategy

the running time is: O(n*L) + T(n) = 2T(n/2) + M(n)

where M(n) is the time corresponding to the merge operation s

mergeSortedLists :: Ord a => [a] -> [a] -> [a] Source #

mergeSortedBy :: (a -> a -> Ordering) -> NonEmpty a -> NonEmpty a -> NonEmpty a Source #

Given an ordering and two nonempty sequences ordered according to that ordering, merge them

mergeSortedListsBy :: (a -> a -> Ordering) -> [a] -> [a] -> [a] Source #

Given an ordering and two nonempty sequences ordered according to that ordering, merge them