Abstract--In this paper, Red-Black Tree is discussed and various operations that can be performed on it are illustrated. The operations include rotation/restructuring (Left-Rotation and Right-Rotation), inserting a node in Red-Black Tree and deleting a node from Red-Black Tree thereby maintaining its Red-Black Properties.
I. Introduction
A fascinating and important balanced binary search tree is the red-black tree. Rudolf Bayer invented this important tree structure in 1972, about 10 years after the introduction of AVL trees. Bayer referred to his red-black trees as “symmetric binary B-trees.”
Red-black trees, as they are now known, like AVL trees, are “self-balancing”. Whenever a new object is inserted or deleted, the resulting tree continues to satisfy the conditions required to be a red-black tree. The computational complexity for insertion or deletion can be shown to be O (log N), similar to an AVL tree. The rules that define a red-black tree are interesting because they are less constrained than the rather strict rules associated with an AVL tree. Each node is assigned a color of red or black [1].
Insertion and deletion operations on red-black trees are more complex to describe or to code than the same operations on AVL trees. Red-black trees also have a higher maximum height than AVL trees for a given number of nodes. The primary advantage of red-black trees is that, in AVL trees, deleting one node from a tree containing n nodes may require log2 n rotations, but deletion in a red-black tree never requires more than three rotations [2].
A. Definition
A red-black tree is a binary search tree with one extra attribute for each node: the color, which is either red or black.
Formally, it is defined as: A red-black tree (RBT) is a binary search tree that satisfies the following red-black properties:
1. Every node has a color that is either red or black.
2. Every leaf is black.
3. If a node is red, both its children are black.
4.
References: [1] en.wikipedia.org/wiki/Red–black_tree [2] Ben Pfaff , “An Introduction to Binary Search Trees and Balanced Trees”, Stanford University, Computer Science Dept. 2002. [3]cs.iupui.edu/~xkzou/teaching/.../Red-black_trees [4] S. Sahni, “Data Structures, Algorithms, and Applications in C++”, McGraw-Hill, 1998.