antisplice-0.16.0.1: An engine for text-based dungeons.

Safe HaskellNone

Game.Antisplice.Utils.AVL

Description

Provides an AVL tree.

Synopsis

Documentation

avlMax :: AVL i -> Maybe iSource

Get the greatest element.

avlMin :: AVL i -> Maybe iSource

Get the least element.

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

Lookup a given key.

avlHeight :: AVL i -> IntSource

Get the height of the tree.

avlSize :: AVL i -> IntSource

Get the size of the tree.

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

Insert into the tree.

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

Remove from the tree.

data AVL a Source

An AVL tree.

Constructors

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

Instances

Functor AVL 
Indexable i o v => AnyBST AVL i o v 
None (AVL a) 

avlRoot :: AVL i -> iSource

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)