Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RBTree ¶
type RBTree struct {
Root *RBTreeNode
}
A Red-Black tree is a binary search tree which has the following red-black properties:
Every node is either red or black.
Every leaf(nil) is black.
If a node is red, then both its children are black.(Which implies that on a path from the root to a leaf, red nodes must not be adjacent. However, any number of black nodes may appear in a sequence.)
Every simple path from a node to a descendant leaf contains the same number of black nodes.
Examples: A basic red-balck tree 11B 2R 14B 1B 7B 15R 5R 8R
func (*RBTree) Insert ¶
func (T *RBTree) Insert(x *RBTreeNode)
type RBTreeNode ¶
type RBTreeNode struct { Key int64 Color Color Value interface{} Left, Right, Parent *RBTreeNode }
Click to show internal directories.
Click to hide internal directories.