Red-Black Tree Deletion
This lesson will cover the deletion function in Red-Black trees and will discuss all four deletion cases.
Deletion in Red-Black Tree #
Before we start discussing how deletion works in a Red-Black tree, let’s discuss the main difference between the Insertion and Deletion operations in Red-Black trees.
In insertion, we may violate the alternating parent-child color property, i.e., a red parent may have a red child. But in the deletion function, we may end up deleting a black node that could violate the property that “the same number of black nodes must exist from the root to the None node for every path.”
In insertion, we check the color of the sibling of the parent of the currentNode and based on the color we perform appropriate operations to balance the tree. But now in the ...