Safe Haskell | Safe-Inferred |
---|

- data AVLTree a
- data Zipper a
- empty :: AVLTree a
- size :: AVLTree a -> Integer
- insert :: Ord a => a -> AVLTree a -> AVLTree a
- search :: Ord a => a -> AVLTree a -> Maybe (Zipper a)
- delete :: Ord a => a -> AVLTree a -> AVLTree a
- value :: Zipper a -> a
- begin :: AVLTree a -> Maybe (Zipper a)
- end :: AVLTree a -> Maybe (Zipper a)
- predecessor :: Ord a => Zipper a -> Maybe (Zipper a)
- successor :: Ord a => Zipper a -> Maybe (Zipper a)

# Documentation

An

is a statically balanced tree, whose non-nil values
have type `AVLTree`

a`a`

.

A `Zipper`

is a useful construct for functional datastructure traversals.
For us, it can be thought of as a pointer to a subtree in an `AVLTree`

.

See Functional Pearls: Zippers for more information.

insert :: Ord a => a -> AVLTree a -> AVLTree aSource

Insert a value into an `AVLTree`

.
If the value already exists, does nothing.

*O(log n)*.

delete :: Ord a => a -> AVLTree a -> AVLTree aSource

Deletes a value from an `AVLTree`

. If the value does not exist in the tree,
does nothing.

*O(log n)*.