SlideShare a Scribd company logo
Red Black Trees ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Red Black Trees ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Example Red-Black Tree 10 7 8 1 5 30 40 20 25 35 45 60 3
Properties ,[object Object]
Properties ,[object Object]
Properties 10 7 8 1 5 30 40 20 25 35 45 60 3
Properties ,[object Object],[object Object],[object Object],[object Object],[object Object]
Properties ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Properties ,[object Object],[object Object],[object Object]
Insert ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Classification Of 2 Red Nodes/Pointers ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],LLb a b c d gp pp p
XYr ,[object Object],[object Object],[object Object],a b c d gp pp p a b c d gp pp p
LLb ,[object Object],[object Object],[object Object],y x a b z c d a b c d gp pp p x y z
LRb ,[object Object],[object Object],[object Object],[object Object],y x a b z c d b c a d gp pp p y x z
Delete ,[object Object],[object Object],[object Object]
Delete A Black Leaf ,[object Object],10 7 8 1 5 30 40 20 25 35 45 60 3
Delete A Black Leaf y ,[object Object],[object Object],py 10 7 1 5 30 40 20 25 35 45 60 3
Delete A Black Degree 1 Node ,[object Object],y ,[object Object],py 10 7 8 1 5 30 40 20 25 35 45 60 3
Delete A Black Degree 2 Node ,[object Object],10 7 8 1 5 30 40 20 25 35 45 60 3
Rebalancing Strategy ,[object Object],10 7 8 1 5 30 40 20 25 35 45 60 3 y py
Rebalancing Strategy ,[object Object],60 10 7 8 1 5 30 40 20 25 35 45 3 y py
Rebalancing Strategy ,[object Object],[object Object],60 10 7 8 1 5 30 40 20 25 35 45 3 y
Rebalancing Strategy ,[object Object],[object Object],[object Object],[object Object],[object Object],a b y py v
Rb0 (case 1) ,[object Object],[object Object],[object Object],a b y py v y a b py v
Rb0 (case 2) ,[object Object],[object Object],[object Object],a b y py v y a b py v
Rb1 (case 1) ,[object Object],[object Object],[object Object],a b y py v a b y v py
Rb1 (case 2) ,[object Object],[object Object],[object Object],a y py v b c w c y w py a b v
Rb2 ,[object Object],[object Object],[object Object],a y py v b c w c y w py a b v
Rr(n) ,[object Object],Rr(2) a y py v b c w
Rr(0) ,[object Object],[object Object],a b y py v a b y v py
Rr(1) (case 1) ,[object Object],[object Object],[object Object],a y py v b w c y c w py a v b
Rr(1) (case 2) ,[object Object],[object Object],[object Object],a y py v b w c d x y d x py a v b c w
Rr(2) ,[object Object],[object Object],[object Object],a y py v b w c d x d y x py a v b c w

More Related Content

What's hot

Red black trees
Red black treesRed black trees
Red black trees
mumairsadiq
 
Balanced Tree(AVL Tree,Red Black Tree)
Balanced Tree(AVL Tree,Red Black Tree)Balanced Tree(AVL Tree,Red Black Tree)
Balanced Tree(AVL Tree,Red Black Tree)
B.Sc in CSE, United International University - UIU, Dhaka
 
Red black trees
Red black treesRed black trees
Red black trees
Amit Kumar Rathi
 
Red black tree
Red black treeRed black tree
Red black tree
Rajendran
 
Red black tree
Red black treeRed black tree
Red black tree
Dr Sandeep Kumar Poonia
 
Red black trees presentation
Red black trees presentationRed black trees presentation
Red black trees presentation
Dexter Paul Gumahad
 
10 Red-Black Trees
10 Red-Black Trees10 Red-Black Trees
10 Red-Black Trees
Andres Mendez-Vazquez
 
Advanced data structures and implementation
Advanced data structures and implementationAdvanced data structures and implementation
Advanced data structures and implementationUmang Gupta
 
Red-black trees
Red-black treesRed-black trees
Red-black trees
sathish sak
 
Balanced Tree (AVL Tree & Red-Black Tree)
Balanced Tree (AVL Tree & Red-Black Tree)Balanced Tree (AVL Tree & Red-Black Tree)
Balanced Tree (AVL Tree & Red-Black Tree)
United International University
 
Balance tree. Short overview
Balance tree. Short overviewBalance tree. Short overview
Balance tree. Short overview
ElifTech
 
lecture 14
lecture 14lecture 14
lecture 14sajinsc
 
Trees, Binary Search Tree, AVL Tree in Data Structures
Trees, Binary Search Tree, AVL Tree in Data Structures Trees, Binary Search Tree, AVL Tree in Data Structures
Trees, Binary Search Tree, AVL Tree in Data Structures
Gurukul Kangri Vishwavidyalaya - Faculty of Engineering and Technology
 
Chap 7 binary threaded tree
Chap 7 binary threaded treeChap 7 binary threaded tree
Chap 7 binary threaded tree
Raj Sarode
 
Data Structure: TREES
Data Structure: TREESData Structure: TREES
Data Structure: TREES
TABISH HAMID
 
Data Structure (Tree)
Data Structure (Tree)Data Structure (Tree)
Data Structure (Tree)
Adam Mukharil Bachtiar
 

What's hot (20)

Red black trees
Red black treesRed black trees
Red black trees
 
Balanced Tree(AVL Tree,Red Black Tree)
Balanced Tree(AVL Tree,Red Black Tree)Balanced Tree(AVL Tree,Red Black Tree)
Balanced Tree(AVL Tree,Red Black Tree)
 
Red black trees
Red black treesRed black trees
Red black trees
 
Red black tree
Red black treeRed black tree
Red black tree
 
Red black tree
Red black treeRed black tree
Red black tree
 
Red black trees presentation
Red black trees presentationRed black trees presentation
Red black trees presentation
 
10 Red-Black Trees
10 Red-Black Trees10 Red-Black Trees
10 Red-Black Trees
 
Advanced data structures and implementation
Advanced data structures and implementationAdvanced data structures and implementation
Advanced data structures and implementation
 
Red-black trees
Red-black treesRed-black trees
Red-black trees
 
Balanced Tree (AVL Tree & Red-Black Tree)
Balanced Tree (AVL Tree & Red-Black Tree)Balanced Tree (AVL Tree & Red-Black Tree)
Balanced Tree (AVL Tree & Red-Black Tree)
 
Lec14
Lec14Lec14
Lec14
 
Balance tree. Short overview
Balance tree. Short overviewBalance tree. Short overview
Balance tree. Short overview
 
lecture 14
lecture 14lecture 14
lecture 14
 
Trees, Binary Search Tree, AVL Tree in Data Structures
Trees, Binary Search Tree, AVL Tree in Data Structures Trees, Binary Search Tree, AVL Tree in Data Structures
Trees, Binary Search Tree, AVL Tree in Data Structures
 
Chap 7 binary threaded tree
Chap 7 binary threaded treeChap 7 binary threaded tree
Chap 7 binary threaded tree
 
Data Structure: TREES
Data Structure: TREESData Structure: TREES
Data Structure: TREES
 
AVL Tree
AVL TreeAVL Tree
AVL Tree
 
Trees
TreesTrees
Trees
 
Avl trees
Avl treesAvl trees
Avl trees
 
Data Structure (Tree)
Data Structure (Tree)Data Structure (Tree)
Data Structure (Tree)
 

Similar to Red black 1

Unit 2 ADvanced Data Sturctures and Algorithms Red-black_trees.ppt
Unit 2 ADvanced Data Sturctures and Algorithms Red-black_trees.pptUnit 2 ADvanced Data Sturctures and Algorithms Red-black_trees.ppt
Unit 2 ADvanced Data Sturctures and Algorithms Red-black_trees.ppt
Sheba41
 
rbtrees.ppt
rbtrees.pptrbtrees.ppt
rbtrees.ppt
Umesh Hengaju
 
Jurnal informatika
Jurnal informatika Jurnal informatika
Jurnal informatika
MamaMa28
 
Cse 225 rbt_red_black_tree
Cse 225 rbt_red_black_treeCse 225 rbt_red_black_tree
Cse 225 rbt_red_black_tree
Sazidur Rahman Sadi
 
Basics of Binary Tree and Binary Search Tree.pptx
Basics of Binary Tree and Binary Search Tree.pptxBasics of Binary Tree and Binary Search Tree.pptx
Basics of Binary Tree and Binary Search Tree.pptx
BhagyashriKotame2
 
Tree
TreeTree
Implement special cases here define delete t v let.pdf
Implement special cases here define delete t v      let.pdfImplement special cases here define delete t v      let.pdf
Implement special cases here define delete t v let.pdf
ADITIEYEWEAR
 
TREES.pptx
TREES.pptxTREES.pptx
Trees in data structure
Trees in data structureTrees in data structure
Trees in data structure
Anusruti Mitra
 
7.tree
7.tree7.tree
anastasio-red-black-trees-1-1-091222204455-phpapp02.pdf
anastasio-red-black-trees-1-1-091222204455-phpapp02.pdfanastasio-red-black-trees-1-1-091222204455-phpapp02.pdf
anastasio-red-black-trees-1-1-091222204455-phpapp02.pdf
AayushAdhikari27
 
Data Structures
Data StructuresData Structures
Data Structures
Nitesh Bichwani
 
Lecture notes data structures tree
Lecture notes data structures   treeLecture notes data structures   tree
Lecture notes data structures tree
maamir farooq
 
Lecture 8 data structures and algorithms
Lecture 8 data structures and algorithmsLecture 8 data structures and algorithms
Lecture 8 data structures and algorithmsAakash deep Singhal
 
Red black trees and their properties
Red black trees and their propertiesRed black trees and their properties
Red black trees and their properties
Kousalya M
 
Tree and binary tree
Tree and binary treeTree and binary tree
Tree and binary tree
Zaid Shabbir
 

Similar to Red black 1 (20)

Unit 2 ADvanced Data Sturctures and Algorithms Red-black_trees.ppt
Unit 2 ADvanced Data Sturctures and Algorithms Red-black_trees.pptUnit 2 ADvanced Data Sturctures and Algorithms Red-black_trees.ppt
Unit 2 ADvanced Data Sturctures and Algorithms Red-black_trees.ppt
 
rbtrees.ppt
rbtrees.pptrbtrees.ppt
rbtrees.ppt
 
16 rbtrees
16 rbtrees16 rbtrees
16 rbtrees
 
Jurnal informatika
Jurnal informatika Jurnal informatika
Jurnal informatika
 
Lec15
Lec15Lec15
Lec15
 
Cse 225 rbt_red_black_tree
Cse 225 rbt_red_black_treeCse 225 rbt_red_black_tree
Cse 225 rbt_red_black_tree
 
Basics of Binary Tree and Binary Search Tree.pptx
Basics of Binary Tree and Binary Search Tree.pptxBasics of Binary Tree and Binary Search Tree.pptx
Basics of Binary Tree and Binary Search Tree.pptx
 
Tree
TreeTree
Tree
 
Implement special cases here define delete t v let.pdf
Implement special cases here define delete t v      let.pdfImplement special cases here define delete t v      let.pdf
Implement special cases here define delete t v let.pdf
 
TREES.pptx
TREES.pptxTREES.pptx
TREES.pptx
 
Trees in data structure
Trees in data structureTrees in data structure
Trees in data structure
 
7.tree
7.tree7.tree
7.tree
 
Lec27
Lec27Lec27
Lec27
 
anastasio-red-black-trees-1-1-091222204455-phpapp02.pdf
anastasio-red-black-trees-1-1-091222204455-phpapp02.pdfanastasio-red-black-trees-1-1-091222204455-phpapp02.pdf
anastasio-red-black-trees-1-1-091222204455-phpapp02.pdf
 
Data Structures
Data StructuresData Structures
Data Structures
 
Lecture notes data structures tree
Lecture notes data structures   treeLecture notes data structures   tree
Lecture notes data structures tree
 
Lecture 8 data structures and algorithms
Lecture 8 data structures and algorithmsLecture 8 data structures and algorithms
Lecture 8 data structures and algorithms
 
lec41.ppt
lec41.pptlec41.ppt
lec41.ppt
 
Red black trees and their properties
Red black trees and their propertiesRed black trees and their properties
Red black trees and their properties
 
Tree and binary tree
Tree and binary treeTree and binary tree
Tree and binary tree
 

More from Core Condor

Graph isomorphism
Graph isomorphismGraph isomorphism
Graph isomorphismCore Condor
 

More from Core Condor (6)

Weighted graphs
Weighted graphsWeighted graphs
Weighted graphs
 
Red black 2
Red black 2Red black 2
Red black 2
 
Graph isomorphism
Graph isomorphismGraph isomorphism
Graph isomorphism
 
Disjoint sets
Disjoint setsDisjoint sets
Disjoint sets
 
Red blacktrees
Red blacktreesRed blacktrees
Red blacktrees
 
2 3 tree
2 3 tree2 3 tree
2 3 tree
 

Recently uploaded

special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
thanhdowork
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
Multithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race conditionMultithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race condition
Mohammed Sikander
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
timhan337
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
Chapter -12, Antibiotics (One Page Notes).pdf
Chapter -12, Antibiotics (One Page Notes).pdfChapter -12, Antibiotics (One Page Notes).pdf
Chapter -12, Antibiotics (One Page Notes).pdf
Kartik Tiwari
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
Nguyen Thanh Tu Collection
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 

Recently uploaded (20)

special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
Multithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race conditionMultithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race condition
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
Chapter -12, Antibiotics (One Page Notes).pdf
Chapter -12, Antibiotics (One Page Notes).pdfChapter -12, Antibiotics (One Page Notes).pdf
Chapter -12, Antibiotics (One Page Notes).pdf
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 

Red black 1

  • 1.
  • 2.
  • 3. Example Red-Black Tree 10 7 8 1 5 30 40 20 25 35 45 60 3
  • 4.
  • 5.
  • 6. Properties 10 7 8 1 5 30 40 20 25 35 45 60 3
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.

Editor's Notes

  1. Every red node has a black parent.
  2. Height = 5
  3. Collapsed height = 3.
  4. Color flip to be defined later. Binary search trees in which each node contains a binary search tree are used, for example, in IP router tables. Each rotation of the outer binary search tree requires changes in the binary search trees of the involved nodes resulting in an O(log n) cost per rotation.
  5. Initially, p is newly inserted node. Pp and gp may be null. In each round, p, pp, and gp are moved up by 2 levels. If p is a red root, make it black. If p or pp black done! If pp is a red root, make it black. O.w., gp exists
  6. If py doesn’t exist, the whole tree is one black node deficient. This is OK.
  7. y represents both a subtree and its root. This includes the case when y is null. Broken lines indicate pointers whose colors are unspecified. v must exist because y is one black node/pointer deficient.