Documentation ¶
Index ¶
- Constants
- func PrintInorder(n *Node)
- type Color
- type Node
- type RBTree
- func (t *RBTree) Delete(key string)
- func (t *RBTree) Get(key string) (interface{}, bool)
- func (t *RBTree) GetNode(key string) (*Node, bool)
- func (t RBTree) Height() int
- func (t *RBTree) Insert(key string, val interface{})
- func (t RBTree) MarshalBinary() ([]byte, error)
- func (t RBTree) Size() int
- func (t RBTree) ToMap() map[string]interface{}
- func (t RBTree) ToString() string
Constants ¶
const Black = false
Black is a basic Coloring constant equaling false
const Red = true
Red is a basic Coloring constant equaling true
Variables ¶
This section is empty.
Functions ¶
func PrintInorder ¶
func PrintInorder(n *Node)
PrintInorder prints out all the nodes of a subtree inorder
Types ¶
type Node ¶
Node are nodes of base BST
func (Node) Compare ¶
Compare compares the Keys of the two nodes returns 1 if n's is greater than other's returns 0 if n's Key is equal to other's returns -1 if n's Key is less than other's
func (*Node) Grandparent ¶
Grandparent returns the grandparent of the current node
func (*Node) RightUncle ¶
RightUncle goes to find the Right uncle and panics if not
type RBTree ¶
RBTree implementation
func (*RBTree) Get ¶
Get returns the value found for a given key, using an a boolean indicator if found
func (*RBTree) GetNode ¶
GetNode returns the node found for a given key, using a boolean indicator if found
func (*RBTree) Insert ¶
Insert inserts with balanced algorithm involved Translated from https://www.cs.auckland.ac.nz/software/AlgAnim/red_black.html
func (RBTree) MarshalBinary ¶
MarshalBinary marshals the tree into a byte format