Red–Black Tree

  • Elshad Karimov


A redblack 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. Redblack 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.

Copyright information

© Elshad Karimov 2020

Authors and Affiliations

  • Elshad Karimov
    • 1
  1. 1.New YorkUSA

Personalised recommendations