Exploring Red Black TreesPranjali Pramod HugayDepartment of Computer ScienceGeorge Mason University Fairfax, United States[email protected]AbstractāIn todayās modern-day world, the Red-Blacktrees have made their presence majorly evidentthroughout our computational infrastructure. The RedBlack tree model for implementing balanced search treeswas introduced by Guibas and Sedge- wick thirty yearsago.ARed Black Treeis a type of self-balancing binarysearch tree, in which every node is colored with a red orblack.Basically, Red-black trees have been createdto be high performance binary search treesthat guarantee O (log N) worst-case timecost for insert, find, and delete operations.This is done by the Red-Black tree byadhering to the strict rules through whichthey maintain logarithmic time complexity. Inthis research paper, we aim to look intoseveral operations carried out Red Blacktrees such as insertion, deletion and search.Some variants of the Red Black tree wouldalso be looked into, along with complexity ofthe tree.KeywordsāInsertion, Deletion, Time ComplexityI.INTRODUCTIONRed-black trees are binary search trees consisting of anadditional ācolorā field which can be of red or blackcolor. In a proper red-black tree, each red-colored nodeis required to have black subtrees and is also regarded asan intermediate auxiliary node. Therefore, every blacknode consists of either 2, 3 or 4 black-colored subtrees,depending on the condition that it has 0, 1 or 2 red-colored direct subtrees. This is why red-black trees canbe seen as a type of implementation of 2-3-4 trees. ARed-Black tree adheres strictly to these invariants(properties): (1) Every node in the tree is ācoloredāeitherredorblack.(2) The root of the tree is alwaysblack. (3) If a node is red, all its children must be black(so canāt have 2 consecutive red nodes on any path fromthe root down to any node). (4) For every node X, everypath from X to a null reference (i.e., an empty left orright child) must contain the same number of blacknodes. This is referred to as black-height. This propertyensures that the tree is balanced.Figure 1. A typical Red-Black TreeWhile representing the red black tree, color of each nodeshould be clearly shown. In the above given figure 1,tree leaf nodes are simply termed as null nodes whichmeans they are not physical nodes. It can be checkedeasily in the above-given tree that there are two types ofnode in which one of them is red and another one isblack in color. The above given tree follows all theproperties of a red black tree.Just like the binary search tree, we can perform thefollowing operations on red-black trees: add a key value(insert), determine whether a key value is in the tree(lookup), remove/eliminate a key value from the tree(delete). Balanced search trees have a height that isalways O(log N). One consequence of height beingXXX-X-XXXX-XXXX-X/XX/$XX.00 Ā©20XX IEEE

O(log N) is that lookup, insert, and delete on a balancedsearch tree can be done in O(log N) worst-case time.

Upload your study docs or become a

Course Hero member to access this document

Upload your study docs or become a

Course Hero member to access this document

End of preview. Want to read all 7 pages?

Upload your study docs or become a

Course Hero member to access this document

Term

Fall

Professor

Nordstrom,D

Tags

Red black tree, Black tree model