-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Tree structures -- -- A collection of heaps and search trees @package TreeStructures @version 0.0.1 module Data.Tree.Splay data (Ord k) => SplayTree k v -- | O(1). head returns the key-value pair of the root. head :: (Ord k) => SplayTree k v -> (k, v) -- | Amortized O(lg n). tail removes the root of the tree and -- merges its subtrees tail :: (Ord k) => SplayTree k v -> SplayTree k v -- | O(1). singleton constructs a splay tree containing one -- element. singleton :: (Ord k) => (k, v) -> SplayTree k v -- | O(1). empty constructs an empty splay tree. empty :: (Ord k) => SplayTree k v -- | O(1). null returns true if a splay tree is empty. null :: (Ord k) => SplayTree k v -> Bool -- | O(n lg n). Constructs a splay tree from an unsorted list of -- key-value pairs. fromList :: (Ord k) => [(k, v)] -> SplayTree k v -- | O(n lg n). Constructs a splay tree from a list of key-value -- pairs sorted in ascending order. fromAscList :: (Ord k) => [(k, v)] -> SplayTree k v -- | O(n lg n). Converts a splay tree into a list of key-value pairs -- with no constraint on ordering. toList :: (Ord k) => SplayTree k v -> [(k, v)] -- | O(n lg n). toAscList converts a splay tree to a list of -- key-value pairs sorted in ascending order. toAscList :: (Ord k) => SplayTree k v -> [(k, v)] -- | Amortized O(lg n). Given a splay tree and a key-value pair, -- insert places the the pair into the tree in BST order. insert :: (Ord k) => SplayTree k v -> (k, v) -> SplayTree k v -- | Amortized O(lg n). Given a splay tree and a key, lookup -- attempts to find a node with the specified key and splays this node to -- the root. If the key is not found, the nearest node is brought to the -- root of the tree. lookup :: (Ord k) => SplayTree k v -> k -> SplayTree k v instance (Ord k, Ord v) => Ord (SplayTree k v) instance (Eq v, Ord k) => Eq (SplayTree k v) module Data.Heap.Skew data (Ord a) => SkewHeap a head :: (Ord a) => SkewHeap a -> a tail :: (Ord a) => SkewHeap a -> SkewHeap a merge :: (Ord a) => SkewHeap a -> SkewHeap a -> SkewHeap a singleton :: (Ord a) => a -> SkewHeap a empty :: (Ord a) => SkewHeap a null :: (Ord a) => SkewHeap a -> Bool fromList :: (Ord a) => [a] -> SkewHeap a toList :: (Ord a) => SkewHeap a -> [a] insert :: (Ord a) => SkewHeap a -> a -> SkewHeap a instance (Ord a) => Eq (SkewHeap a) instance (Ord a) => Ord (SkewHeap a) module Data.Heap.Binomial data (Ord a, Eq a) => BinomialHeap a -- | O(lg n) head :: (Ord a) => BinomialHeap a -> a -- | O(lg n) tail :: (Ord a) => BinomialHeap a -> BinomialHeap a -- | O(lg n). merge :: (Ord a) => BinomialHeap a -> BinomialHeap a -> BinomialHeap a -- | O(1). singleton :: (Ord a) => a -> BinomialHeap a empty :: (Ord a) => BinomialHeap a null :: (Ord a) => BinomialHeap a -> Bool -- | O(n) fromList :: (Ord a, Eq a) => [a] -> BinomialHeap a -- | O(n lg n) toList :: (Ord a) => BinomialHeap a -> [a] -- | O(lg n) insert :: (Ord a) => BinomialHeap a -> a -> BinomialHeap a instance (Ord a) => Eq (BinomialHeap a) instance (Ord a) => Ord (BinomialHeap a) instance (Ord a, Ord b, Eq a, Eq b) => Eq (HeapNode a b) instance (Ord a, Ord b, Eq a, Eq b) => Ord (HeapNode a b) -- | Data.Heap.Binary provides a binary min-heap. Balance is -- maintained through descendant counting. module Data.Heap.Binary data (Ord n) => BinaryHeap n -- | O(1). head returns the element root of the heap. head :: (Ord a) => BinaryHeap a -> a -- | O(lg n). tail discards the root of the heap and merges -- the subtrees. tail :: (Ord a) => BinaryHeap a -> BinaryHeap a -- | merge consumes two binary heaps and merges them. merge :: (Ord a) => BinaryHeap a -> BinaryHeap a -> BinaryHeap a -- | O(1). singleton consumes an element and constructs a -- singleton heap. singleton :: (Ord a) => a -> BinaryHeap a -- | O(1). empty produces an empty heap. empty :: (Ord a) => BinaryHeap a -- | O(1). null :: (Ord a) => BinaryHeap a -> Bool -- | O(n). fromList constructs a binary heap from an unsorted -- list. fromList :: (Ord a) => [a] -> BinaryHeap a -- | O(n lg n). toList :: (Ord a) => BinaryHeap a -> [a] -- | O(lg n). insert :: (Ord a) => BinaryHeap a -> a -> BinaryHeap a instance (Ord n) => Eq (BinaryHeap n) instance (Ord n) => Ord (BinaryHeap n) instance (Ord n, Show n) => Show (BinaryHeap n)