red-black-tree-0.1.0.0: Red Black Trees implemented in Haskell
Copyright(c) 2017 Gabriel Aumala
LicenseBSD3
Maintainergabriel@criptext.com
Stabilityexperimental
PortabilityGHC
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.RedBlackTree.Internal

Description

Data types and functions used internally by Data.RedBlackTree. You don't need to know anything about this if you only want to consume the RedBlackTree library.

Synopsis

Documentation

getBlackHeight :: BinaryTreeNode a => RedBlackTree a -> Int Source #

Returns the black-height of a RedBlackTree, the uniform number of black nodes in any path from the root to any leaf at the bottom of the tree. This is a O(Log(n)) operation.

emptyRedBlackTree :: RedBlackTree a Source #

Convenient function to "create" a new empty tree.

find :: BinaryTreeNode a => RedBlackTree a -> a -> Maybe a Source #

Lookup a target node in the tree. The target value doesn't need to be the exact same value that is already in the tree. It only needs to satisfy the Eq instance

data RedBlack Source #

Red black trees can only have two types of nodes: Red and Black.

Constructors

Red 
Black 

Instances

Instances details
Show RedBlack Source # 
Instance details

Defined in Data.RedBlackTree.Internal

Eq RedBlack Source # 
Instance details

Defined in Data.RedBlackTree.Internal

Ord RedBlack Source # 
Instance details

Defined in Data.RedBlackTree.Internal

data RedBlackNode a Source #

a RedBlackNode contains only two elements, the color of the node and the actual content.

Constructors

RedBlackNode RedBlack a 

type RedBlackTree a = BinaryTree (RedBlackNode a) Source #

A BinaryTree with only nodes of type RedBlackNode. is either a Leaf (empty) or a RedBlackNode with 2 RedBlackTree children: left and right

data WhiteBranch a Source #

Constructors

WhiteBranch (RedBlackTree a) a (RedBlackTree a) 

Instances

Instances details
(BinaryTreeNode a, Show a) => Show (WhiteBranch a) Source # 
Instance details

Defined in Data.RedBlackTree.Internal

BinaryTreeNode a => Eq (WhiteBranch a) Source # 
Instance details

Defined in Data.RedBlackTree.Internal

BinaryTreeNode a => Ord (WhiteBranch a) Source # 
Instance details

Defined in Data.RedBlackTree.Internal