chatty-utils-0.7.3.3: Some utilities every serious chatty-based application may need.

Safe HaskellSafe
LanguageHaskell2010

Data.Chatty.AVL

Description

Provides an AVL tree.

Synopsis

Documentation

avlMax :: AVL i -> Maybe i Source

Get the greatest element.

avlMin :: AVL i -> Maybe i Source

Get the least element.

avlLookup :: Indexable i o v => o -> AVL i -> Maybe v Source

Lookup a given key.

avlHeight :: AVL i -> Int Source

Get the height of the tree.

avlSize :: AVL i -> Int Source

Get the size of the tree.

avlInsert :: Indexable i o v => i -> AVL i -> AVL i Source

Insert into the tree.

avlRemove :: Indexable i o v => o -> AVL i -> AVL i Source

Remove from the tree.

data AVL a Source

An AVL tree.

Constructors

EmptyAVL 
AVL a Int Int !(AVL a) !(AVL a) 

Instances

avlRoot :: AVL i -> i Source

Get the root of the tree.

avlPreorder :: AVL i -> [i] Source

Traverse the tree, order (head, left, right)

avlPostorder :: AVL i -> [i] Source

Traverse the tree, order (left, right, head)

avlInorder :: AVL i -> [i] Source

Traverse the tree, order (left, head, right)