Red–black tree

Creator
Creator
Seonglae ChoSeonglae Cho
Created
Created
2023 Sep 27 6:48
Editor
Edited
Edited
2023 Oct 26 5:40
Refs
Refs

Results

  • smallest is alway left-most
 
 

Properties

  • Every node is either red or black
  • The root and leaves are black
  • If a node is red, then its parent is black
  • All simple paths from any node to a descendant leaf have the same number of black nodes
    • Simple paths means path without repetition
 
 
 

Theorem

A red-black tree with keys has height
  • Merge red nodes into their black parents
  • This process produces a tree in which each node has 2,3, or 4 children
  • The 2-3-4 trees has uniform depth of leaves
 
 
 

Corollary

  • search, min, max, successor, predecessor all run in
 

insertion and deletion through rotation run in

A rotation can be performed in time
notion image
  1. insert
  1. recolor
  1. right rotate child
  1. left rotate parent
  1. recolor
delete is
 
 
 

Enhancement

you can enhance in various ways
Let as max value, we can achieve performance
where , Therefore, the array consists of many duplicated small values.
 
 
 
 
 
 

Recommendations