llrbtree-0.0.0: Left-Leaning Red-Black Tree

Data.RBTree

Contents

Description

Purely functional red-black trees.

Synopsis

Data structures

data RBTree a Source

Constructors

Leaf 
Node Color !BlackHeight !(RBTree a) a !(RBTree a) 

Instances

Eq a => Eq (RBTree a) 
Show a => Show (RBTree a) 

data Color Source

Constructors

B

Black

R

Red

Instances

type BlackHeight = IntSource

Red nodes have the same BlackHeight of their parent.

Creating red-black trees

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

fromList :: Ord a => [a] -> RBTree aSource

Converting a list

toList :: RBTree a -> [a]Source

Membership

member :: Ord a => a -> RBTree a -> BoolSource

Deleting

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

Set operations

union :: Ord a => RBTree a -> RBTree a -> RBTree aSource

Helper functions

join :: Ord a => RBTree a -> a -> RBTree a -> RBTree aSource

merge :: Ord a => RBTree a -> RBTree a -> RBTree aSource

split :: Ord a => a -> RBTree a -> (RBTree a, RBTree a)Source

valid :: Ord a => RBTree a -> BoolSource