Binary Search Tree Is A Node-Based Binary Tree
Binary Search Tree Is A Node-Based Binary Tree
The above properties of Binary Search Tree provides an ordering among keys so
that the operations like search, minimum and maximum can be done fast. If there
is no ordering, then we may have to compare every key to search for a given key.
Searching in binary search tree
• A red-black tree is a binary search tree with one extra attribute for
each node: the colour, which is either red or black.
A red-black tree is a binary search tree which has the following red-
black properties:
• Every node is either red or black.
• The root of the tree is always black.
• Every leaf (NULL) is black.
• If a node is red, then both its children are black. Means that on any
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.