Data.SegmentTree.Examples
Description
Example uses of SegmentTrees.
- intervalSum :: SegmentTree (Sum Int) -> (Int, Int) -> Int
- intervalAny :: SegmentTree Any -> (Int, Int) -> Bool
- newtype Integral a => GCD a = GCD {
- getGCD :: a
- intervalGCD :: SegmentTree (GCD Int) -> (Int, Int) -> Int
- intervalConcat :: SegmentTree String -> (Int, Int) -> String
- newtype Unwords = Unwords {
- getUnwords :: String
- intervalUnwords :: SegmentTree Unwords -> (Int, Int) -> String
Sum Monoid
intervalSum :: SegmentTree (Sum Int) -> (Int, Int) -> IntSource
Find the sum of the elements in the interval [l, u].
Any Monoid
intervalAny :: SegmentTree Any -> (Int, Int) -> BoolSource
Find out if any of the elements are True in the interval [l, u].
GCD Monoid
intervalGCD :: SegmentTree (GCD Int) -> (Int, Int) -> IntSource
Find the greatest common divisor of the elements in the interval [l, u].
String Monoid
intervalConcat :: SegmentTree String -> (Int, Int) -> StringSource
Concatenate the strings in the interval [l, u].
Unwords Monoid
intervalUnwords :: SegmentTree Unwords -> (Int, Int) -> StringSource
Unwords the words in the interval [l, u].