Abstract

A red–black tree (RBT) is a type of Binary Search Tree where a new parameter – color for each node – has been defined (Figure 12-1). We learned that after some insert and delete operations, the binary search trees become unbalanced which creates a linked list. Red–black trees solve this problem by balancing elements. Each node has a color which can be black or red. Thus, when declaring a node for the RBT, it must contain a key/value, a color, the reference to a parent node, and the references for the children nodes. RBTs are very useful for worst-case scenarios when processing search, insertion, and deletion operations.

Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call