Skip to Content
C# Data Structures and Algorithms
book

C# Data Structures and Algorithms

by Marcin Jamro
April 2018
Intermediate to advanced content levelIntermediate to advanced
292 pages
6h 44m
English
Packt Publishing
Content preview from C# Data Structures and Algorithms

Red-black trees

A Red-black tree, also referred to as an RBT, is the next variant of the self-balancing binary search trees. As a variant of BSTs, this data structure requires that the standard BST rules be maintained. Moreover, the following rules must be taken into account:

  • Each node must be colored either red or black. Thus, you need to add additional data for a node that stores a color.
  • All nodes with values cannot be leaf nodes. For this reason, the NIL pseudo-nodes should be used as leaves in the tree, while all other nodes are internal ones. Moreover, all NIL pseudo-nodes must be black.
  • If a node is red, both its children must be black.
  • For any node, the number of black nodes on the route to a descendant leaf (that is, the NIL pseudo-node) ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Beginning Data Structures and Algorithms in C#

Beginning Data Structures and Algorithms in C#

Marcin Jamro

Publisher Resources

ISBN: 9781788833738Supplemental Content