SlideShare a Scribd company logo
BLG 335E – Analysis of Algorithms I
Fall 2013, Recitation 5
11.12.2013
R.A. Atakan Aral
aralat@itu.edu.tr – Research Lab 1
R.A. Doğan Altan
daltan@itu.edu.tr – Research Lab 3
Question 1
• Insert the following sequence of numbers
into a 2-3-4 tree
– {53, 27, 75, 25, 70, 41, 38, 16, 59, 36, 73, 65, 60,
46, 55, 33, 68, 79, 48}
Solution 1
• 2-3-4 tree: Perfect balance by allowing 1, 2,
or 3 keys per node:
– 2-node: one key, two children.
– 3-node: two keys, three children.
– 4-node: three keys, four children.
• Every path from root to leaf has the same
length.
Solution 1 (Cont.)
• {53, 27, 75, 25, 70, 41, 38, 16, 59, 36, 73, 65,
60, 46, 55, 33, 68, 79, 48}
53
Solution 1 (Cont.)
• {53, 27, 75, 25, 70, 41, 38, 16, 59, 36, 73, 65,
60, 46, 55, 33, 68, 79, 48}
27 53
Solution 1 (Cont.)
• {53, 27, 75, 25, 70, 41, 38, 16, 59, 36, 73, 65,
60, 46, 55, 33, 68, 79, 48}
27 53 75
Solution 1 (Cont.)
• {53, 27, 75, 25, 70, 41, 38, 16, 59, 36, 73, 65,
60, 46, 55, 33, 68, 79, 48}  causes a split
53
7527
Solution 1 (Cont.)
• {53, 27, 75, 25, 70, 41, 38, 16, 59, 36, 73, 65,
60, 46, 55, 33, 68, 79, 48}  causes a split
53
25 27 75
Solution 1 (Cont.)
• {53, 27, 75, 25, 70, 41, 38, 16, 59, 36, 73, 65,
60, 46, 55, 33, 68, 79, 48}
70 75
53
25 27
Solution 1 (Cont.)
• {53, 27, 75, 25, 70, 41, 38, 16, 59, 36, 73, 65,
60, 46, 55, 33, 68, 79, 48}
70 7525 27 41
53
Solution 1 (Cont.)
• {53, 27, 75, 25, 70, 41, 38, 16, 59, 36, 73, 65,
60, 46, 55, 33, 68, 79, 48}  causes a split
27 53
70 7525 41
Solution 1 (Cont.)
• {53, 27, 75, 25, 70, 41, 38, 16, 59, 36, 73, 65,
60, 46, 55, 33, 68, 79, 48}  causes a split
27 53
38 41 70 7525
Solution 1 (Cont.)
• {53, 27, 75, 25, 70, 41, 38, 16, 59, 36, 73, 65,
60, 46, 55, 33, 68, 79, 48}
16 25
27 53
38 41 70 75
Solution 1 (Cont.)
• {53, 27, 75, 25, 70, 41, 38, 16, 59, 36, 73, 65,
60, 46, 55, 33, 68, 79, 48}
16 25
27 53
59 70 7538 41
Solution 1 (Cont.)
• {53, 27, 75, 25, 70, 41, 38, 16, 59, 36, 73, 65,
60, 46, 55, 33, 68, 79, 48}
16 25 36 38 41
27 53
59 70 75
Solution 1 (Cont.)
• {53, 27, 75, 25, 70, 41, 38, 16, 59, 36, 73, 65,
60, 46, 55, 33, 68, 79, 48}  causes a split
16 25
27 53 70
36 38 41 59 75
Solution 1 (Cont.)
• {53, 27, 75, 25, 70, 41, 38, 16, 59, 36, 73, 65,
60, 46, 55, 33, 68, 79, 48}  causes a split
16 25
27 53 70
73 7536 38 41 59
Solution 1 (Cont.)
• {53, 27, 75, 25, 70, 41, 38, 16, 59, 36, 73, 65,
60, 46, 55, 33, 68, 79, 48}
16 25
27 53 70
73 7536 38 41 59 65
Solution 1 (Cont.)
• {53, 27, 75, 25, 70, 41, 38, 16, 59, 36, 73, 65,
60, 46, 55, 33, 68, 79, 48}
16 25 59 60 65
27 53 70
73 7536 38 41
Solution 1 (Cont.)
• {53, 27, 75, 25, 70, 41, 38, 16, 59, 36, 73, 65,
60, 46, 55, 33, 68, 79, 48}  causes a split
that propagates up to the root
53
27 38
16 25 73 7536
70
59 60 6541
Solution 1 (Cont.)
• {53, 27, 75, 25, 70, 41, 38, 16, 59, 36, 73, 65,
60, 46, 55, 33, 68, 79, 48}  causes a split
that propagates up to the root
53
27 38
16 25 41 46 73 7536
70
59 60 65
Solution 1 (Cont.)
• {53, 27, 75, 25, 70, 41, 38, 16, 59, 36, 73, 65,
60, 46, 55, 33, 68, 79, 48}  causes a split
53
27 38
16 25
60 70
41 46 73 756536 59
Solution 1 (Cont.)
• {53, 27, 75, 25, 70, 41, 38, 16, 59, 36, 73, 65,
60, 46, 55, 33, 68, 79, 48}  causes a split
53
27 38
16 25
60 70
55 5941 46 73 756536
Solution 1 (Cont.)
• {53, 27, 75, 25, 70, 41, 38, 16, 59, 36, 73, 65,
60, 46, 55, 33, 68, 79, 48}
53
27 38
33 3616 25
60 70
55 5941 46 73 7565
Solution 1 (Cont.)
• {53, 27, 75, 25, 70, 41, 38, 16, 59, 36, 73, 65,
60, 46, 55, 33, 68, 79, 48}
53
27 38
33 3616 25
60 70
65 6855 5941 46 73 75
Solution 1 (Cont.)
• {53, 27, 75, 25, 70, 41, 38, 16, 59, 36, 73, 65,
60, 46, 55, 33, 68, 79, 48}
53
27 38
33 3616 25
60 70
65 6855 59 73 75 7941 46
Solution 1 (Cont.)
• {53, 27, 75, 25, 70, 41, 38, 16, 59, 36, 73, 65,
60, 46, 55, 33, 68, 79, 48}
53
27 38
33 3616 25 41 46 48
60 70
65 6855 59 73 75 79
Question 2
• 2-3-4 trees are balanced and can be searched in
𝑂(𝑙𝑜𝑔𝑛), but they have different node structures.
• To get 2-3-4 tree advantages in a binary tree format,
we can represent it as a red-black tree.
• Convert the following 2-3-4 tree to a red-black tree
53
27 38
16 25 41 46 73 7536
70
59 60 65
Solution 2
• Properties of a red-black tree:
– the root is always black
– black condition: every path from the root to a
leaf node has the same number of black nodes
– red condition: every red node has a black
parent
Solution 2 (Cont.)
• 2-nodes: can be represented with a black node
• 4-nodes: center value becomes the parent (black)
and the others become children (red)
X Y Z
X
A B
X
A B
A B C D
X
Y
Z
A B C D
Solution 2 (Cont.)
• 3-nodes:
• Note:
1.Red-black trees are not unique
2.However, the corresponding 2-3-4 tree is unique
X Y
A B C
X
Y
A B
C
X
YA
B C
or
Solution 2 (Cont.)
• Top-down conversion algorithm (start at the root):
1. Apply red-black tree representation to each node
2. Repeat for next level…
53
27 38
16 25 41 46 73 7536
70
59 60 65
Solution 2 (Cont.)
53
27 38
16 25 41 46 73 7536
70
59 60 65
53
27
16 25 41 46 73 7536 59 60 65
7038
Solution 2 (Cont.)
53
27
7336
7038
25
16
46
41
7560
6559
Solution 2 (Cont.)
Question 3
• Insert the following sequence of numbers
into a red-black tree
– {2, 1, 4, 5, 9, 3, 6, 7}
Analysis of Algorithms - 5
Solution 3
 {2, 1, 4, 5, 9, 3, 6, 7}
2
 {2, 1, 4, 5, 9, 3, 6, 7}
2
1
Solution 3 (Cont.)
 {2, 1, 4, 5, 9, 3, 6, 7}
2
1 4
Solution 3 (Cont.)
Solution 3 (Cont.)
 {2, 1, 4, 5, 9, 3, 6, 7}  recoloring
2
1 4
5
2
1 4
5
2
1 4
5
case1 case0
Solution 3 (Cont.)
 {2, 1, 4, 5, 9, 3, 6, 7}  recoloring and rotation
2
1 4
5
9
2
1 4
5
9
2
1 5
94
case3
step1
case3
step2
Solution 3 (Cont.)
 {2, 1, 4, 5, 9, 3, 6, 7}  recoloring
2
1 5
94
3
2
1 5
94
3
case1
Solution 3 (Cont.)
 {2, 1, 4, 5, 9, 3, 6, 7}
2
1 5
94
3 6
Solution 3 (Cont.)
 {2, 1, 4, 5, 9, 3, 6, 7}  recoloring
2
1 5
94
3 6
7
2
1 5
94
3 6
7
case2
step1
Solution 3 (Cont.)
 {2, 1, 4, 5, 9, 3, 6, 7}  2 rotations
2
1 5
94
3 6
7
2
1 5
94
3 7
6
2
1 5
74
3 6 9
case2
step2
case2
step3
Question 4
• Delete 90, 80 and 70 from the following
red-black tree in the given order
65
50 80
90706010
62
Analysis of Algorithms - 5
Solution 4 (Cont.)
• Delete 90, 80 and 70
65
50 80
90706010
62
65
50 80
706010
62
Solution 4 (Cont.)
• Delete 90, 80 and 70
65
50 80
706010
62
65
50 80
706010
62
case2
Solution 4 (Cont.)
• Delete 90, 80 and 70
65
50 80
706010
62
65
50 70
6010
62
absorb black
Solution 4 (Cont.)
• Delete 90, 80 and 70
65
50 70
6010
62
65
50
6010
62
Solution 4 (Cont.)
• Delete 90, 80 and 70
65
50
6010
62
50
10 65
60
62
case1
Solution 4 (Cont.)
• Delete 90, 80 and 70
50
10 65
60
62
50
10 65
62
60
case4
Solution 4 (Cont.)
• Delete 90, 80 and 70
50
10 65
62
60
50
10 62
60 65
case3

More Related Content

What's hot (11)

Introduction to machine learning algorithms
Introduction to machine learning algorithmsIntroduction to machine learning algorithms
Introduction to machine learning algorithms
bigdata trunk
 
Index laws ppt
Index laws pptIndex laws ppt
Index laws ppt
EdTechonGC Mallett
 
Solving First Derivative Equation
Solving First Derivative EquationSolving First Derivative Equation
Solving First Derivative Equation
Aulia Khalqillah
 
Solutions manual for prealgebra 2nd edition by miller
Solutions manual for prealgebra 2nd edition by millerSolutions manual for prealgebra 2nd edition by miller
Solutions manual for prealgebra 2nd edition by miller
Poppy1824
 
Ch 1 Final 10Math.pdf
Ch 1 Final 10Math.pdfCh 1 Final 10Math.pdf
Ch 1 Final 10Math.pdf
HabibDawar3
 
Data Science process
Data Science processData Science process
Data Science process
bigdata trunk
 
Kelantan mtambahan + skema
Kelantan mtambahan + skemaKelantan mtambahan + skema
Kelantan mtambahan + skema
Shopink Wonderland
 
Minimal dominating functions of corona product graph of a cycle with a compl
Minimal dominating functions of corona product graph of a cycle with a complMinimal dominating functions of corona product graph of a cycle with a compl
Minimal dominating functions of corona product graph of a cycle with a compl
IAEME Publication
 
Operaciones Con Enteros
Operaciones Con EnterosOperaciones Con Enteros
Operaciones Con Enteros
Fernando Salamero
 
Latihan 3.3
Latihan 3.3Latihan 3.3
Latihan 3.3
Rahmah Nadiyah
 
Quadratic Formula
Quadratic FormulaQuadratic Formula
Quadratic Formula
Kaleb Nygaard
 
Introduction to machine learning algorithms
Introduction to machine learning algorithmsIntroduction to machine learning algorithms
Introduction to machine learning algorithms
bigdata trunk
 
Solving First Derivative Equation
Solving First Derivative EquationSolving First Derivative Equation
Solving First Derivative Equation
Aulia Khalqillah
 
Solutions manual for prealgebra 2nd edition by miller
Solutions manual for prealgebra 2nd edition by millerSolutions manual for prealgebra 2nd edition by miller
Solutions manual for prealgebra 2nd edition by miller
Poppy1824
 
Ch 1 Final 10Math.pdf
Ch 1 Final 10Math.pdfCh 1 Final 10Math.pdf
Ch 1 Final 10Math.pdf
HabibDawar3
 
Data Science process
Data Science processData Science process
Data Science process
bigdata trunk
 
Minimal dominating functions of corona product graph of a cycle with a compl
Minimal dominating functions of corona product graph of a cycle with a complMinimal dominating functions of corona product graph of a cycle with a compl
Minimal dominating functions of corona product graph of a cycle with a compl
IAEME Publication
 

Viewers also liked (18)

Software Engineering - RS4
Software Engineering - RS4Software Engineering - RS4
Software Engineering - RS4
AtakanAral
 
Software Engineering - RS3
Software Engineering - RS3Software Engineering - RS3
Software Engineering - RS3
AtakanAral
 
Mobile Multi-domain Search over Structured Web Data
Mobile Multi-domain Search over Structured Web DataMobile Multi-domain Search over Structured Web Data
Mobile Multi-domain Search over Structured Web Data
AtakanAral
 
Analysis of Algorithms - 1
Analysis of Algorithms - 1Analysis of Algorithms - 1
Analysis of Algorithms - 1
AtakanAral
 
Comm 4228 Exploroo
Comm 4228 ExplorooComm 4228 Exploroo
Comm 4228 Exploroo
KathleenMadsen
 
Analysis of Algorithms II - PS3
Analysis of Algorithms II - PS3Analysis of Algorithms II - PS3
Analysis of Algorithms II - PS3
AtakanAral
 
Introduction to Social Media Marketing and Social Media Strategy
Introduction to Social Media Marketing and Social Media StrategyIntroduction to Social Media Marketing and Social Media Strategy
Introduction to Social Media Marketing and Social Media Strategy
Albert Qian
 
How HR Can Use Social Media for Recruitment and Candidate Engagement
How HR Can Use Social Media for Recruitment and Candidate EngagementHow HR Can Use Social Media for Recruitment and Candidate Engagement
How HR Can Use Social Media for Recruitment and Candidate Engagement
Albert Qian
 
Propuesta de campaña política
Propuesta de campaña políticaPropuesta de campaña política
Propuesta de campaña política
Renato Hernández Rodríguez
 
How to Triple Your Job Offers
How to Triple Your Job OffersHow to Triple Your Job Offers
How to Triple Your Job Offers
Albert Qian
 
Modeling and Optimization of Resource Allocation in Cloud [PhD Thesis Progres...
Modeling and Optimization of Resource Allocation in Cloud [PhD Thesis Progres...Modeling and Optimization of Resource Allocation in Cloud [PhD Thesis Progres...
Modeling and Optimization of Resource Allocation in Cloud [PhD Thesis Progres...
AtakanAral
 
Analysis of Algorithms II - PS2
Analysis of Algorithms II - PS2Analysis of Algorithms II - PS2
Analysis of Algorithms II - PS2
AtakanAral
 
Modeling and Optimization of Resource Allocation in Cloud [PhD Thesis Progres...
Modeling and Optimization of Resource Allocation in Cloud [PhD Thesis Progres...Modeling and Optimization of Resource Allocation in Cloud [PhD Thesis Progres...
Modeling and Optimization of Resource Allocation in Cloud [PhD Thesis Progres...
AtakanAral
 
Modeling and Optimization of Resource Allocation in Cloud [PhD Thesis Progres...
Modeling and Optimization of Resource Allocation in Cloud [PhD Thesis Progres...Modeling and Optimization of Resource Allocation in Cloud [PhD Thesis Progres...
Modeling and Optimization of Resource Allocation in Cloud [PhD Thesis Progres...
AtakanAral
 
Analysis of Algorithms II - PS5
Analysis of Algorithms II - PS5Analysis of Algorithms II - PS5
Analysis of Algorithms II - PS5
AtakanAral
 
Modeling and Optimization of Resource Allocation in Cloud [PhD Thesis Progres...
Modeling and Optimization of Resource Allocation in Cloud [PhD Thesis Progres...Modeling and Optimization of Resource Allocation in Cloud [PhD Thesis Progres...
Modeling and Optimization of Resource Allocation in Cloud [PhD Thesis Progres...
AtakanAral
 
50777360 basic-manual-workshop-repair-manuals-325-and-337
50777360 basic-manual-workshop-repair-manuals-325-and-33750777360 basic-manual-workshop-repair-manuals-325-and-337
50777360 basic-manual-workshop-repair-manuals-325-and-337
Walter Mazibuko
 
[1]관계chap 9
[1]관계chap 9[1]관계chap 9
[1]관계chap 9
현식 조
 
Software Engineering - RS4
Software Engineering - RS4Software Engineering - RS4
Software Engineering - RS4
AtakanAral
 
Software Engineering - RS3
Software Engineering - RS3Software Engineering - RS3
Software Engineering - RS3
AtakanAral
 
Mobile Multi-domain Search over Structured Web Data
Mobile Multi-domain Search over Structured Web DataMobile Multi-domain Search over Structured Web Data
Mobile Multi-domain Search over Structured Web Data
AtakanAral
 
Analysis of Algorithms - 1
Analysis of Algorithms - 1Analysis of Algorithms - 1
Analysis of Algorithms - 1
AtakanAral
 
Analysis of Algorithms II - PS3
Analysis of Algorithms II - PS3Analysis of Algorithms II - PS3
Analysis of Algorithms II - PS3
AtakanAral
 
Introduction to Social Media Marketing and Social Media Strategy
Introduction to Social Media Marketing and Social Media StrategyIntroduction to Social Media Marketing and Social Media Strategy
Introduction to Social Media Marketing and Social Media Strategy
Albert Qian
 
How HR Can Use Social Media for Recruitment and Candidate Engagement
How HR Can Use Social Media for Recruitment and Candidate EngagementHow HR Can Use Social Media for Recruitment and Candidate Engagement
How HR Can Use Social Media for Recruitment and Candidate Engagement
Albert Qian
 
How to Triple Your Job Offers
How to Triple Your Job OffersHow to Triple Your Job Offers
How to Triple Your Job Offers
Albert Qian
 
Modeling and Optimization of Resource Allocation in Cloud [PhD Thesis Progres...
Modeling and Optimization of Resource Allocation in Cloud [PhD Thesis Progres...Modeling and Optimization of Resource Allocation in Cloud [PhD Thesis Progres...
Modeling and Optimization of Resource Allocation in Cloud [PhD Thesis Progres...
AtakanAral
 
Analysis of Algorithms II - PS2
Analysis of Algorithms II - PS2Analysis of Algorithms II - PS2
Analysis of Algorithms II - PS2
AtakanAral
 
Modeling and Optimization of Resource Allocation in Cloud [PhD Thesis Progres...
Modeling and Optimization of Resource Allocation in Cloud [PhD Thesis Progres...Modeling and Optimization of Resource Allocation in Cloud [PhD Thesis Progres...
Modeling and Optimization of Resource Allocation in Cloud [PhD Thesis Progres...
AtakanAral
 
Modeling and Optimization of Resource Allocation in Cloud [PhD Thesis Progres...
Modeling and Optimization of Resource Allocation in Cloud [PhD Thesis Progres...Modeling and Optimization of Resource Allocation in Cloud [PhD Thesis Progres...
Modeling and Optimization of Resource Allocation in Cloud [PhD Thesis Progres...
AtakanAral
 
Analysis of Algorithms II - PS5
Analysis of Algorithms II - PS5Analysis of Algorithms II - PS5
Analysis of Algorithms II - PS5
AtakanAral
 
Modeling and Optimization of Resource Allocation in Cloud [PhD Thesis Progres...
Modeling and Optimization of Resource Allocation in Cloud [PhD Thesis Progres...Modeling and Optimization of Resource Allocation in Cloud [PhD Thesis Progres...
Modeling and Optimization of Resource Allocation in Cloud [PhD Thesis Progres...
AtakanAral
 
50777360 basic-manual-workshop-repair-manuals-325-and-337
50777360 basic-manual-workshop-repair-manuals-325-and-33750777360 basic-manual-workshop-repair-manuals-325-and-337
50777360 basic-manual-workshop-repair-manuals-325-and-337
Walter Mazibuko
 
[1]관계chap 9
[1]관계chap 9[1]관계chap 9
[1]관계chap 9
현식 조
 

Similar to Analysis of Algorithms - 5 (20)

Lecture 44
Lecture 44Lecture 44
Lecture 44
Faisal Mehmood
 
3. D&C and Recurrence Relation.ppYtxVVVV
3. D&C and Recurrence Relation.ppYtxVVVV3. D&C and Recurrence Relation.ppYtxVVVV
3. D&C and Recurrence Relation.ppYtxVVVV
NetraBansal3
 
Lecture 5 6_7 - divide and conquer and method of solving recurrences
Lecture 5 6_7 - divide and conquer and method of solving recurrencesLecture 5 6_7 - divide and conquer and method of solving recurrences
Lecture 5 6_7 - divide and conquer and method of solving recurrences
jayavignesh86
 
lecture 4
lecture 4lecture 4
lecture 4
sajinsc
 
Ada
AdaAda
Ada
Deven Rathore
 
P1-07-Recurrences.pdf
P1-07-Recurrences.pdfP1-07-Recurrences.pdf
P1-07-Recurrences.pdf
ssuser08dcf1
 
Master method
Master method Master method
Master method
Rajendran
 
Algorithm chapter 8
Algorithm chapter 8Algorithm chapter 8
Algorithm chapter 8
chidabdu
 
Recurrences
RecurrencesRecurrences
Recurrences
DEVTYPE
 
Gwt sdm public
Gwt sdm publicGwt sdm public
Gwt sdm public
Yasuo Tabei
 
Color Coding-Related Techniques
Color Coding-Related TechniquesColor Coding-Related Techniques
Color Coding-Related Techniques
cseiitgn
 
Andrew Daws - Final Project Report
Andrew Daws - Final Project ReportAndrew Daws - Final Project Report
Andrew Daws - Final Project Report
Andrew Daws
 
Daa chapter 2
Daa chapter 2Daa chapter 2
Daa chapter 2
B.Kirron Reddi
 
DAA UNIT-4 (1).pdf
DAA UNIT-4 (1).pdfDAA UNIT-4 (1).pdf
DAA UNIT-4 (1).pdf
ssuser1eba0d
 
3. Recursion and Recurrences.ppt detail about recursive learning
3. Recursion and Recurrences.ppt detail about recursive learning3. Recursion and Recurrences.ppt detail about recursive learning
3. Recursion and Recurrences.ppt detail about recursive learning
KashifNadeem52
 
8.-DAA-LECTURE-8-RECURRENCES-AND-ITERATION-METHOD.pdf
8.-DAA-LECTURE-8-RECURRENCES-AND-ITERATION-METHOD.pdf8.-DAA-LECTURE-8-RECURRENCES-AND-ITERATION-METHOD.pdf
8.-DAA-LECTURE-8-RECURRENCES-AND-ITERATION-METHOD.pdf
RishikeshJha33
 
Creating red black tree
Creating red black treeCreating red black tree
Creating red black tree
harman kaur
 
High School Placement Test: Quantitative Skills
High School Placement Test: Quantitative SkillsHigh School Placement Test: Quantitative Skills
High School Placement Test: Quantitative Skills
Gregory Tewksbury
 
Applied Algorithms and Structures week999
Applied Algorithms and Structures week999Applied Algorithms and Structures week999
Applied Algorithms and Structures week999
fashiontrendzz20
 
Algorithm Assignment Help
Algorithm Assignment HelpAlgorithm Assignment Help
Algorithm Assignment Help
Programming Homework Help
 
3. D&C and Recurrence Relation.ppYtxVVVV
3. D&C and Recurrence Relation.ppYtxVVVV3. D&C and Recurrence Relation.ppYtxVVVV
3. D&C and Recurrence Relation.ppYtxVVVV
NetraBansal3
 
Lecture 5 6_7 - divide and conquer and method of solving recurrences
Lecture 5 6_7 - divide and conquer and method of solving recurrencesLecture 5 6_7 - divide and conquer and method of solving recurrences
Lecture 5 6_7 - divide and conquer and method of solving recurrences
jayavignesh86
 
lecture 4
lecture 4lecture 4
lecture 4
sajinsc
 
P1-07-Recurrences.pdf
P1-07-Recurrences.pdfP1-07-Recurrences.pdf
P1-07-Recurrences.pdf
ssuser08dcf1
 
Master method
Master method Master method
Master method
Rajendran
 
Algorithm chapter 8
Algorithm chapter 8Algorithm chapter 8
Algorithm chapter 8
chidabdu
 
Recurrences
RecurrencesRecurrences
Recurrences
DEVTYPE
 
Color Coding-Related Techniques
Color Coding-Related TechniquesColor Coding-Related Techniques
Color Coding-Related Techniques
cseiitgn
 
Andrew Daws - Final Project Report
Andrew Daws - Final Project ReportAndrew Daws - Final Project Report
Andrew Daws - Final Project Report
Andrew Daws
 
DAA UNIT-4 (1).pdf
DAA UNIT-4 (1).pdfDAA UNIT-4 (1).pdf
DAA UNIT-4 (1).pdf
ssuser1eba0d
 
3. Recursion and Recurrences.ppt detail about recursive learning
3. Recursion and Recurrences.ppt detail about recursive learning3. Recursion and Recurrences.ppt detail about recursive learning
3. Recursion and Recurrences.ppt detail about recursive learning
KashifNadeem52
 
8.-DAA-LECTURE-8-RECURRENCES-AND-ITERATION-METHOD.pdf
8.-DAA-LECTURE-8-RECURRENCES-AND-ITERATION-METHOD.pdf8.-DAA-LECTURE-8-RECURRENCES-AND-ITERATION-METHOD.pdf
8.-DAA-LECTURE-8-RECURRENCES-AND-ITERATION-METHOD.pdf
RishikeshJha33
 
Creating red black tree
Creating red black treeCreating red black tree
Creating red black tree
harman kaur
 
High School Placement Test: Quantitative Skills
High School Placement Test: Quantitative SkillsHigh School Placement Test: Quantitative Skills
High School Placement Test: Quantitative Skills
Gregory Tewksbury
 
Applied Algorithms and Structures week999
Applied Algorithms and Structures week999Applied Algorithms and Structures week999
Applied Algorithms and Structures week999
fashiontrendzz20
 

More from AtakanAral (9)

Subgraph Matching for Resource Allocation in the Federated Cloud Environment
Subgraph Matching for Resource Allocation in the Federated Cloud EnvironmentSubgraph Matching for Resource Allocation in the Federated Cloud Environment
Subgraph Matching for Resource Allocation in the Federated Cloud Environment
AtakanAral
 
Quality of Service Channelling for Latency Sensitive Edge Applications
Quality of Service Channelling for Latency Sensitive Edge ApplicationsQuality of Service Channelling for Latency Sensitive Edge Applications
Quality of Service Channelling for Latency Sensitive Edge Applications
AtakanAral
 
Resource Mapping Optimization for Distributed Cloud Services - PhD Thesis Def...
Resource Mapping Optimization for Distributed Cloud Services - PhD Thesis Def...Resource Mapping Optimization for Distributed Cloud Services - PhD Thesis Def...
Resource Mapping Optimization for Distributed Cloud Services - PhD Thesis Def...
AtakanAral
 
Software Engineering - RS2
Software Engineering - RS2Software Engineering - RS2
Software Engineering - RS2
AtakanAral
 
Software Engineering - RS1
Software Engineering - RS1Software Engineering - RS1
Software Engineering - RS1
AtakanAral
 
Modeling and Optimization of Resource Allocation in Cloud [PhD Thesis Proposal]
Modeling and Optimization of Resource Allocation in Cloud [PhD Thesis Proposal]Modeling and Optimization of Resource Allocation in Cloud [PhD Thesis Proposal]
Modeling and Optimization of Resource Allocation in Cloud [PhD Thesis Proposal]
AtakanAral
 
Improving Resource Utilization in Cloud using Application Placement Heuristics
Improving Resource Utilization in Cloud using Application Placement HeuristicsImproving Resource Utilization in Cloud using Application Placement Heuristics
Improving Resource Utilization in Cloud using Application Placement Heuristics
AtakanAral
 
Analysis of Algorithms - 3
Analysis of Algorithms - 3Analysis of Algorithms - 3
Analysis of Algorithms - 3
AtakanAral
 
Analysis of Algorithms - 2
Analysis of Algorithms - 2Analysis of Algorithms - 2
Analysis of Algorithms - 2
AtakanAral
 
Subgraph Matching for Resource Allocation in the Federated Cloud Environment
Subgraph Matching for Resource Allocation in the Federated Cloud EnvironmentSubgraph Matching for Resource Allocation in the Federated Cloud Environment
Subgraph Matching for Resource Allocation in the Federated Cloud Environment
AtakanAral
 
Quality of Service Channelling for Latency Sensitive Edge Applications
Quality of Service Channelling for Latency Sensitive Edge ApplicationsQuality of Service Channelling for Latency Sensitive Edge Applications
Quality of Service Channelling for Latency Sensitive Edge Applications
AtakanAral
 
Resource Mapping Optimization for Distributed Cloud Services - PhD Thesis Def...
Resource Mapping Optimization for Distributed Cloud Services - PhD Thesis Def...Resource Mapping Optimization for Distributed Cloud Services - PhD Thesis Def...
Resource Mapping Optimization for Distributed Cloud Services - PhD Thesis Def...
AtakanAral
 
Software Engineering - RS2
Software Engineering - RS2Software Engineering - RS2
Software Engineering - RS2
AtakanAral
 
Software Engineering - RS1
Software Engineering - RS1Software Engineering - RS1
Software Engineering - RS1
AtakanAral
 
Modeling and Optimization of Resource Allocation in Cloud [PhD Thesis Proposal]
Modeling and Optimization of Resource Allocation in Cloud [PhD Thesis Proposal]Modeling and Optimization of Resource Allocation in Cloud [PhD Thesis Proposal]
Modeling and Optimization of Resource Allocation in Cloud [PhD Thesis Proposal]
AtakanAral
 
Improving Resource Utilization in Cloud using Application Placement Heuristics
Improving Resource Utilization in Cloud using Application Placement HeuristicsImproving Resource Utilization in Cloud using Application Placement Heuristics
Improving Resource Utilization in Cloud using Application Placement Heuristics
AtakanAral
 
Analysis of Algorithms - 3
Analysis of Algorithms - 3Analysis of Algorithms - 3
Analysis of Algorithms - 3
AtakanAral
 
Analysis of Algorithms - 2
Analysis of Algorithms - 2Analysis of Algorithms - 2
Analysis of Algorithms - 2
AtakanAral
 

Recently uploaded (20)

What's-New-with-BoxLang-Brad Wood.pptx.pdf
What's-New-with-BoxLang-Brad Wood.pptx.pdfWhat's-New-with-BoxLang-Brad Wood.pptx.pdf
What's-New-with-BoxLang-Brad Wood.pptx.pdf
Ortus Solutions, Corp
 
Professional Consulting Resume of AL Davis
Professional Consulting Resume of AL DavisProfessional Consulting Resume of AL Davis
Professional Consulting Resume of AL Davis
ald303873
 
Multiple Platforms of Unity Game Development.pdf
Multiple Platforms of Unity Game Development.pdfMultiple Platforms of Unity Game Development.pdf
Multiple Platforms of Unity Game Development.pdf
Nova Carter
 
Progecad 2025 Professional Cracked [Latest]
Progecad 2025 Professional Cracked [Latest]Progecad 2025 Professional Cracked [Latest]
Progecad 2025 Professional Cracked [Latest]
Luisa Weist
 
Portland Marketo User Group: MOPs & AI - Jeff Canada - May 2025
Portland Marketo User Group: MOPs & AI - Jeff Canada - May 2025Portland Marketo User Group: MOPs & AI - Jeff Canada - May 2025
Portland Marketo User Group: MOPs & AI - Jeff Canada - May 2025
BradBedford3
 
TUG Brazil - VizQL Data Service - Nik Dutra.pdf
TUG Brazil - VizQL Data Service - Nik Dutra.pdfTUG Brazil - VizQL Data Service - Nik Dutra.pdf
TUG Brazil - VizQL Data Service - Nik Dutra.pdf
Ligia Galvão
 
arvr & metaverse development services.pdf
arvr & metaverse development services.pdfarvr & metaverse development services.pdf
arvr & metaverse development services.pdf
marketing810348
 
Why You Should Invest in Claims management Software
Why You Should Invest in Claims management SoftwareWhy You Should Invest in Claims management Software
Why You Should Invest in Claims management Software
Insurance Tech Services
 
German Marketo User Group - May 2025 survey results
German Marketo User Group - May 2025 survey resultsGerman Marketo User Group - May 2025 survey results
German Marketo User Group - May 2025 survey results
BradBedford3
 
VFP-Report-Copy-Data-Environment details
VFP-Report-Copy-Data-Environment detailsVFP-Report-Copy-Data-Environment details
VFP-Report-Copy-Data-Environment details
manojbkalla
 
Agentic AI Desgin Principles in five slides.pptx
Agentic AI Desgin Principles in five slides.pptxAgentic AI Desgin Principles in five slides.pptx
Agentic AI Desgin Principles in five slides.pptx
MOSIUOA WESI
 
Salesforce Experience Cloud Consulting.pdf
Salesforce Experience Cloud Consulting.pdfSalesforce Experience Cloud Consulting.pdf
Salesforce Experience Cloud Consulting.pdf
VALiNTRY360
 
Building AI agents with Java and LangChain4j
Building AI agents with Java and LangChain4jBuilding AI agents with Java and LangChain4j
Building AI agents with Java and LangChain4j
Julien Dubois
 
LightBurn 1.7.0.6 + Crack Download🔓
LightBurn  1.7.0.6  +  Crack  Download🔓LightBurn  1.7.0.6  +  Crack  Download🔓
LightBurn 1.7.0.6 + Crack Download🔓
Berkeley
 
Introduction to QM, QA, QC, Bug's priority and severity
Introduction to QM, QA, QC, Bug's priority and severityIntroduction to QM, QA, QC, Bug's priority and severity
Introduction to QM, QA, QC, Bug's priority and severity
Arshad QA
 
Field service report Luzon.pptxxxxxxxxxxxxxxxx
Field service report Luzon.pptxxxxxxxxxxxxxxxxField service report Luzon.pptxxxxxxxxxxxxxxxx
Field service report Luzon.pptxxxxxxxxxxxxxxxx
kashinathgpsgc
 
system-and-network-administration pptx-.pdf
system-and-network-administration pptx-.pdfsystem-and-network-administration pptx-.pdf
system-and-network-administration pptx-.pdf
Tof Abdu
 
CFCamp2025 - Keynote Day 1 led by Luis Majano.pdf
CFCamp2025 - Keynote Day 1 led by Luis Majano.pdfCFCamp2025 - Keynote Day 1 led by Luis Majano.pdf
CFCamp2025 - Keynote Day 1 led by Luis Majano.pdf
Ortus Solutions, Corp
 
Why-Choose-an-Authorised-Microsoft-Reseller.pptx
Why-Choose-an-Authorised-Microsoft-Reseller.pptxWhy-Choose-an-Authorised-Microsoft-Reseller.pptx
Why-Choose-an-Authorised-Microsoft-Reseller.pptx
Michael cole
 
Best Practices Salesforce Training & Documentation.pptx
Best Practices Salesforce Training & Documentation.pptxBest Practices Salesforce Training & Documentation.pptx
Best Practices Salesforce Training & Documentation.pptx
Michael Orias
 
What's-New-with-BoxLang-Brad Wood.pptx.pdf
What's-New-with-BoxLang-Brad Wood.pptx.pdfWhat's-New-with-BoxLang-Brad Wood.pptx.pdf
What's-New-with-BoxLang-Brad Wood.pptx.pdf
Ortus Solutions, Corp
 
Professional Consulting Resume of AL Davis
Professional Consulting Resume of AL DavisProfessional Consulting Resume of AL Davis
Professional Consulting Resume of AL Davis
ald303873
 
Multiple Platforms of Unity Game Development.pdf
Multiple Platforms of Unity Game Development.pdfMultiple Platforms of Unity Game Development.pdf
Multiple Platforms of Unity Game Development.pdf
Nova Carter
 
Progecad 2025 Professional Cracked [Latest]
Progecad 2025 Professional Cracked [Latest]Progecad 2025 Professional Cracked [Latest]
Progecad 2025 Professional Cracked [Latest]
Luisa Weist
 
Portland Marketo User Group: MOPs & AI - Jeff Canada - May 2025
Portland Marketo User Group: MOPs & AI - Jeff Canada - May 2025Portland Marketo User Group: MOPs & AI - Jeff Canada - May 2025
Portland Marketo User Group: MOPs & AI - Jeff Canada - May 2025
BradBedford3
 
TUG Brazil - VizQL Data Service - Nik Dutra.pdf
TUG Brazil - VizQL Data Service - Nik Dutra.pdfTUG Brazil - VizQL Data Service - Nik Dutra.pdf
TUG Brazil - VizQL Data Service - Nik Dutra.pdf
Ligia Galvão
 
arvr & metaverse development services.pdf
arvr & metaverse development services.pdfarvr & metaverse development services.pdf
arvr & metaverse development services.pdf
marketing810348
 
Why You Should Invest in Claims management Software
Why You Should Invest in Claims management SoftwareWhy You Should Invest in Claims management Software
Why You Should Invest in Claims management Software
Insurance Tech Services
 
German Marketo User Group - May 2025 survey results
German Marketo User Group - May 2025 survey resultsGerman Marketo User Group - May 2025 survey results
German Marketo User Group - May 2025 survey results
BradBedford3
 
VFP-Report-Copy-Data-Environment details
VFP-Report-Copy-Data-Environment detailsVFP-Report-Copy-Data-Environment details
VFP-Report-Copy-Data-Environment details
manojbkalla
 
Agentic AI Desgin Principles in five slides.pptx
Agentic AI Desgin Principles in five slides.pptxAgentic AI Desgin Principles in five slides.pptx
Agentic AI Desgin Principles in five slides.pptx
MOSIUOA WESI
 
Salesforce Experience Cloud Consulting.pdf
Salesforce Experience Cloud Consulting.pdfSalesforce Experience Cloud Consulting.pdf
Salesforce Experience Cloud Consulting.pdf
VALiNTRY360
 
Building AI agents with Java and LangChain4j
Building AI agents with Java and LangChain4jBuilding AI agents with Java and LangChain4j
Building AI agents with Java and LangChain4j
Julien Dubois
 
LightBurn 1.7.0.6 + Crack Download🔓
LightBurn  1.7.0.6  +  Crack  Download🔓LightBurn  1.7.0.6  +  Crack  Download🔓
LightBurn 1.7.0.6 + Crack Download🔓
Berkeley
 
Introduction to QM, QA, QC, Bug's priority and severity
Introduction to QM, QA, QC, Bug's priority and severityIntroduction to QM, QA, QC, Bug's priority and severity
Introduction to QM, QA, QC, Bug's priority and severity
Arshad QA
 
Field service report Luzon.pptxxxxxxxxxxxxxxxx
Field service report Luzon.pptxxxxxxxxxxxxxxxxField service report Luzon.pptxxxxxxxxxxxxxxxx
Field service report Luzon.pptxxxxxxxxxxxxxxxx
kashinathgpsgc
 
system-and-network-administration pptx-.pdf
system-and-network-administration pptx-.pdfsystem-and-network-administration pptx-.pdf
system-and-network-administration pptx-.pdf
Tof Abdu
 
CFCamp2025 - Keynote Day 1 led by Luis Majano.pdf
CFCamp2025 - Keynote Day 1 led by Luis Majano.pdfCFCamp2025 - Keynote Day 1 led by Luis Majano.pdf
CFCamp2025 - Keynote Day 1 led by Luis Majano.pdf
Ortus Solutions, Corp
 
Why-Choose-an-Authorised-Microsoft-Reseller.pptx
Why-Choose-an-Authorised-Microsoft-Reseller.pptxWhy-Choose-an-Authorised-Microsoft-Reseller.pptx
Why-Choose-an-Authorised-Microsoft-Reseller.pptx
Michael cole
 
Best Practices Salesforce Training & Documentation.pptx
Best Practices Salesforce Training & Documentation.pptxBest Practices Salesforce Training & Documentation.pptx
Best Practices Salesforce Training & Documentation.pptx
Michael Orias
 

Analysis of Algorithms - 5

  • 1. BLG 335E – Analysis of Algorithms I Fall 2013, Recitation 5 11.12.2013 R.A. Atakan Aral [email protected] – Research Lab 1 R.A. Doğan Altan [email protected] – Research Lab 3
  • 2. Question 1 • Insert the following sequence of numbers into a 2-3-4 tree – {53, 27, 75, 25, 70, 41, 38, 16, 59, 36, 73, 65, 60, 46, 55, 33, 68, 79, 48}
  • 3. Solution 1 • 2-3-4 tree: Perfect balance by allowing 1, 2, or 3 keys per node: – 2-node: one key, two children. – 3-node: two keys, three children. – 4-node: three keys, four children. • Every path from root to leaf has the same length.
  • 4. Solution 1 (Cont.) • {53, 27, 75, 25, 70, 41, 38, 16, 59, 36, 73, 65, 60, 46, 55, 33, 68, 79, 48} 53
  • 5. Solution 1 (Cont.) • {53, 27, 75, 25, 70, 41, 38, 16, 59, 36, 73, 65, 60, 46, 55, 33, 68, 79, 48} 27 53
  • 6. Solution 1 (Cont.) • {53, 27, 75, 25, 70, 41, 38, 16, 59, 36, 73, 65, 60, 46, 55, 33, 68, 79, 48} 27 53 75
  • 7. Solution 1 (Cont.) • {53, 27, 75, 25, 70, 41, 38, 16, 59, 36, 73, 65, 60, 46, 55, 33, 68, 79, 48}  causes a split 53 7527
  • 8. Solution 1 (Cont.) • {53, 27, 75, 25, 70, 41, 38, 16, 59, 36, 73, 65, 60, 46, 55, 33, 68, 79, 48}  causes a split 53 25 27 75
  • 9. Solution 1 (Cont.) • {53, 27, 75, 25, 70, 41, 38, 16, 59, 36, 73, 65, 60, 46, 55, 33, 68, 79, 48} 70 75 53 25 27
  • 10. Solution 1 (Cont.) • {53, 27, 75, 25, 70, 41, 38, 16, 59, 36, 73, 65, 60, 46, 55, 33, 68, 79, 48} 70 7525 27 41 53
  • 11. Solution 1 (Cont.) • {53, 27, 75, 25, 70, 41, 38, 16, 59, 36, 73, 65, 60, 46, 55, 33, 68, 79, 48}  causes a split 27 53 70 7525 41
  • 12. Solution 1 (Cont.) • {53, 27, 75, 25, 70, 41, 38, 16, 59, 36, 73, 65, 60, 46, 55, 33, 68, 79, 48}  causes a split 27 53 38 41 70 7525
  • 13. Solution 1 (Cont.) • {53, 27, 75, 25, 70, 41, 38, 16, 59, 36, 73, 65, 60, 46, 55, 33, 68, 79, 48} 16 25 27 53 38 41 70 75
  • 14. Solution 1 (Cont.) • {53, 27, 75, 25, 70, 41, 38, 16, 59, 36, 73, 65, 60, 46, 55, 33, 68, 79, 48} 16 25 27 53 59 70 7538 41
  • 15. Solution 1 (Cont.) • {53, 27, 75, 25, 70, 41, 38, 16, 59, 36, 73, 65, 60, 46, 55, 33, 68, 79, 48} 16 25 36 38 41 27 53 59 70 75
  • 16. Solution 1 (Cont.) • {53, 27, 75, 25, 70, 41, 38, 16, 59, 36, 73, 65, 60, 46, 55, 33, 68, 79, 48}  causes a split 16 25 27 53 70 36 38 41 59 75
  • 17. Solution 1 (Cont.) • {53, 27, 75, 25, 70, 41, 38, 16, 59, 36, 73, 65, 60, 46, 55, 33, 68, 79, 48}  causes a split 16 25 27 53 70 73 7536 38 41 59
  • 18. Solution 1 (Cont.) • {53, 27, 75, 25, 70, 41, 38, 16, 59, 36, 73, 65, 60, 46, 55, 33, 68, 79, 48} 16 25 27 53 70 73 7536 38 41 59 65
  • 19. Solution 1 (Cont.) • {53, 27, 75, 25, 70, 41, 38, 16, 59, 36, 73, 65, 60, 46, 55, 33, 68, 79, 48} 16 25 59 60 65 27 53 70 73 7536 38 41
  • 20. Solution 1 (Cont.) • {53, 27, 75, 25, 70, 41, 38, 16, 59, 36, 73, 65, 60, 46, 55, 33, 68, 79, 48}  causes a split that propagates up to the root 53 27 38 16 25 73 7536 70 59 60 6541
  • 21. Solution 1 (Cont.) • {53, 27, 75, 25, 70, 41, 38, 16, 59, 36, 73, 65, 60, 46, 55, 33, 68, 79, 48}  causes a split that propagates up to the root 53 27 38 16 25 41 46 73 7536 70 59 60 65
  • 22. Solution 1 (Cont.) • {53, 27, 75, 25, 70, 41, 38, 16, 59, 36, 73, 65, 60, 46, 55, 33, 68, 79, 48}  causes a split 53 27 38 16 25 60 70 41 46 73 756536 59
  • 23. Solution 1 (Cont.) • {53, 27, 75, 25, 70, 41, 38, 16, 59, 36, 73, 65, 60, 46, 55, 33, 68, 79, 48}  causes a split 53 27 38 16 25 60 70 55 5941 46 73 756536
  • 24. Solution 1 (Cont.) • {53, 27, 75, 25, 70, 41, 38, 16, 59, 36, 73, 65, 60, 46, 55, 33, 68, 79, 48} 53 27 38 33 3616 25 60 70 55 5941 46 73 7565
  • 25. Solution 1 (Cont.) • {53, 27, 75, 25, 70, 41, 38, 16, 59, 36, 73, 65, 60, 46, 55, 33, 68, 79, 48} 53 27 38 33 3616 25 60 70 65 6855 5941 46 73 75
  • 26. Solution 1 (Cont.) • {53, 27, 75, 25, 70, 41, 38, 16, 59, 36, 73, 65, 60, 46, 55, 33, 68, 79, 48} 53 27 38 33 3616 25 60 70 65 6855 59 73 75 7941 46
  • 27. Solution 1 (Cont.) • {53, 27, 75, 25, 70, 41, 38, 16, 59, 36, 73, 65, 60, 46, 55, 33, 68, 79, 48} 53 27 38 33 3616 25 41 46 48 60 70 65 6855 59 73 75 79
  • 28. Question 2 • 2-3-4 trees are balanced and can be searched in 𝑂(𝑙𝑜𝑔𝑛), but they have different node structures. • To get 2-3-4 tree advantages in a binary tree format, we can represent it as a red-black tree. • Convert the following 2-3-4 tree to a red-black tree 53 27 38 16 25 41 46 73 7536 70 59 60 65
  • 29. Solution 2 • Properties of a red-black tree: – the root is always black – black condition: every path from the root to a leaf node has the same number of black nodes – red condition: every red node has a black parent
  • 30. Solution 2 (Cont.) • 2-nodes: can be represented with a black node • 4-nodes: center value becomes the parent (black) and the others become children (red) X Y Z X A B X A B A B C D X Y Z A B C D
  • 31. Solution 2 (Cont.) • 3-nodes: • Note: 1.Red-black trees are not unique 2.However, the corresponding 2-3-4 tree is unique X Y A B C X Y A B C X YA B C or
  • 32. Solution 2 (Cont.) • Top-down conversion algorithm (start at the root): 1. Apply red-black tree representation to each node 2. Repeat for next level… 53 27 38 16 25 41 46 73 7536 70 59 60 65
  • 33. Solution 2 (Cont.) 53 27 38 16 25 41 46 73 7536 70 59 60 65
  • 34. 53 27 16 25 41 46 73 7536 59 60 65 7038 Solution 2 (Cont.)
  • 36. Question 3 • Insert the following sequence of numbers into a red-black tree – {2, 1, 4, 5, 9, 3, 6, 7}
  • 38. Solution 3  {2, 1, 4, 5, 9, 3, 6, 7} 2
  • 39.  {2, 1, 4, 5, 9, 3, 6, 7} 2 1 Solution 3 (Cont.)
  • 40.  {2, 1, 4, 5, 9, 3, 6, 7} 2 1 4 Solution 3 (Cont.)
  • 41. Solution 3 (Cont.)  {2, 1, 4, 5, 9, 3, 6, 7}  recoloring 2 1 4 5 2 1 4 5 2 1 4 5 case1 case0
  • 42. Solution 3 (Cont.)  {2, 1, 4, 5, 9, 3, 6, 7}  recoloring and rotation 2 1 4 5 9 2 1 4 5 9 2 1 5 94 case3 step1 case3 step2
  • 43. Solution 3 (Cont.)  {2, 1, 4, 5, 9, 3, 6, 7}  recoloring 2 1 5 94 3 2 1 5 94 3 case1
  • 44. Solution 3 (Cont.)  {2, 1, 4, 5, 9, 3, 6, 7} 2 1 5 94 3 6
  • 45. Solution 3 (Cont.)  {2, 1, 4, 5, 9, 3, 6, 7}  recoloring 2 1 5 94 3 6 7 2 1 5 94 3 6 7 case2 step1
  • 46. Solution 3 (Cont.)  {2, 1, 4, 5, 9, 3, 6, 7}  2 rotations 2 1 5 94 3 6 7 2 1 5 94 3 7 6 2 1 5 74 3 6 9 case2 step2 case2 step3
  • 47. Question 4 • Delete 90, 80 and 70 from the following red-black tree in the given order 65 50 80 90706010 62
  • 49. Solution 4 (Cont.) • Delete 90, 80 and 70 65 50 80 90706010 62 65 50 80 706010 62
  • 50. Solution 4 (Cont.) • Delete 90, 80 and 70 65 50 80 706010 62 65 50 80 706010 62 case2
  • 51. Solution 4 (Cont.) • Delete 90, 80 and 70 65 50 80 706010 62 65 50 70 6010 62 absorb black
  • 52. Solution 4 (Cont.) • Delete 90, 80 and 70 65 50 70 6010 62 65 50 6010 62
  • 53. Solution 4 (Cont.) • Delete 90, 80 and 70 65 50 6010 62 50 10 65 60 62 case1
  • 54. Solution 4 (Cont.) • Delete 90, 80 and 70 50 10 65 60 62 50 10 65 62 60 case4
  • 55. Solution 4 (Cont.) • Delete 90, 80 and 70 50 10 65 62 60 50 10 62 60 65 case3