Safe Haskell | Safe-Inferred |
---|
Provides a typeclass for all binary search trees and an unbalanced implementation
- class Ord o => Indexable i o v | i -> o, i -> v where
- class Indexable i o v => AnyBST t i o v where
- anyBstInsert :: i -> t i -> t i
- anyBstRemove :: o -> t i -> t i
- anyBstMax :: t i -> Maybe i
- anyBstMin :: t i -> Maybe i
- anyBstLookup :: o -> t i -> Maybe v
- anyBstEmpty :: t i
- data BST a
- bstInsert :: Indexable i o v => i -> BST i -> BST i
- bstRemove :: Indexable i o v => o -> BST i -> BST i
- bstMax :: BST i -> Maybe i
- bstMin :: BST i -> Maybe i
- bstLookup :: Indexable i o v => o -> BST i -> Maybe v
Documentation
class Ord o => Indexable i o v | i -> o, i -> v whereSource
Only instances of Indexable may be saved in a BST
class Indexable i o v => AnyBST t i o v whereSource
Typeclass for all BSTs that store the given Indexable
anyBstInsert :: i -> t i -> t iSource
Insert into the tree
anyBstRemove :: o -> t i -> t iSource
Remove from the tree
anyBstMax :: t i -> Maybe iSource
Get the greatest element
anyBstMin :: t i -> Maybe iSource
Get the least element
anyBstLookup :: o -> t i -> Maybe vSource
Lookup a given key
anyBstEmpty :: t iSource
An empty tree
An unbalanced binary search tree