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
Ad

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
현식 조
 
Ad

Similar to Analysis of Algorithms - 5 (20)

Mat 045 final exam review part i
Mat 045 final exam review   part iMat 045 final exam review   part i
Mat 045 final exam review part i
Mae Guerra
 
Material algebra
Material algebraMaterial algebra
Material algebra
Juan Ladino
 
Frequency distribution
Frequency distributionFrequency distribution
Frequency distribution
ali waqas
 
National_3_Unit_3.pdf...................
National_3_Unit_3.pdf...................National_3_Unit_3.pdf...................
National_3_Unit_3.pdf...................
willoio45
 
The sexagesimal foundation of mathematics
The sexagesimal foundation of mathematicsThe sexagesimal foundation of mathematics
The sexagesimal foundation of mathematics
MichielKarskens
 
filipe-costa-thesis-presentation-static-ilovepdf-compressed
filipe-costa-thesis-presentation-static-ilovepdf-compressedfilipe-costa-thesis-presentation-static-ilovepdf-compressed
filipe-costa-thesis-presentation-static-ilovepdf-compressed
Filipe Costa
 
Numerical Methods: Solution of system of equations
Numerical Methods: Solution of system of equationsNumerical Methods: Solution of system of equations
Numerical Methods: Solution of system of equations
Nikolai Priezjev
 
GREKing: Vedic Maths Concept
GREKing: Vedic Maths ConceptGREKing: Vedic Maths Concept
GREKing: Vedic Maths Concept
Rahul Singh
 
Lca10 0505
Lca10 0505Lca10 0505
Lca10 0505
Venkata RamBabu
 
Base 8
Base 8Base 8
Base 8
Nadeem Uddin
 
Mathsclub.pptx
Mathsclub.pptxMathsclub.pptx
Mathsclub.pptx
MuraliKrishnaShah1
 
08 clustering
08 clustering08 clustering
08 clustering
นนทวัฒน์ บุญบา
 
unsupervised classification.pdf
unsupervised classification.pdfunsupervised classification.pdf
unsupervised classification.pdf
surjeetkoli900
 
Precalculus 10 Sequences and Series.pptx
Precalculus 10 Sequences and Series.pptxPrecalculus 10 Sequences and Series.pptx
Precalculus 10 Sequences and Series.pptx
DominicCaling
 
BST.pptx
BST.pptxBST.pptx
BST.pptx
NewUser84
 
Content schedule bt
Content schedule btContent schedule bt
Content schedule bt
btmathematics
 
Quarter 1 Math 10 Lesson about Geometric Sequence
Quarter 1 Math 10 Lesson about Geometric SequenceQuarter 1 Math 10 Lesson about Geometric Sequence
Quarter 1 Math 10 Lesson about Geometric Sequence
LoradelElida1
 
Measure of dispersion statistics
Measure of dispersion statisticsMeasure of dispersion statistics
Measure of dispersion statistics
Tanvirkhan164
 
Geometric Sequence
Geometric SequenceGeometric Sequence
Geometric Sequence
Joey Fontanilla Valdriz
 
Sampling
SamplingSampling
Sampling
Nadeem Uddin
 
Mat 045 final exam review part i
Mat 045 final exam review   part iMat 045 final exam review   part i
Mat 045 final exam review part i
Mae Guerra
 
Material algebra
Material algebraMaterial algebra
Material algebra
Juan Ladino
 
Frequency distribution
Frequency distributionFrequency distribution
Frequency distribution
ali waqas
 
National_3_Unit_3.pdf...................
National_3_Unit_3.pdf...................National_3_Unit_3.pdf...................
National_3_Unit_3.pdf...................
willoio45
 
The sexagesimal foundation of mathematics
The sexagesimal foundation of mathematicsThe sexagesimal foundation of mathematics
The sexagesimal foundation of mathematics
MichielKarskens
 
filipe-costa-thesis-presentation-static-ilovepdf-compressed
filipe-costa-thesis-presentation-static-ilovepdf-compressedfilipe-costa-thesis-presentation-static-ilovepdf-compressed
filipe-costa-thesis-presentation-static-ilovepdf-compressed
Filipe Costa
 
Numerical Methods: Solution of system of equations
Numerical Methods: Solution of system of equationsNumerical Methods: Solution of system of equations
Numerical Methods: Solution of system of equations
Nikolai Priezjev
 
GREKing: Vedic Maths Concept
GREKing: Vedic Maths ConceptGREKing: Vedic Maths Concept
GREKing: Vedic Maths Concept
Rahul Singh
 
unsupervised classification.pdf
unsupervised classification.pdfunsupervised classification.pdf
unsupervised classification.pdf
surjeetkoli900
 
Precalculus 10 Sequences and Series.pptx
Precalculus 10 Sequences and Series.pptxPrecalculus 10 Sequences and Series.pptx
Precalculus 10 Sequences and Series.pptx
DominicCaling
 
Quarter 1 Math 10 Lesson about Geometric Sequence
Quarter 1 Math 10 Lesson about Geometric SequenceQuarter 1 Math 10 Lesson about Geometric Sequence
Quarter 1 Math 10 Lesson about Geometric Sequence
LoradelElida1
 
Measure of dispersion statistics
Measure of dispersion statisticsMeasure of dispersion statistics
Measure of dispersion statistics
Tanvirkhan164
 
Ad

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)

Surviving a Downturn Making Smarter Portfolio Decisions with OnePlan - Webina...
Surviving a Downturn Making Smarter Portfolio Decisions with OnePlan - Webina...Surviving a Downturn Making Smarter Portfolio Decisions with OnePlan - Webina...
Surviving a Downturn Making Smarter Portfolio Decisions with OnePlan - Webina...
OnePlan Solutions
 
Memory Management and Leaks in Postgres from pgext.day 2025
Memory Management and Leaks in Postgres from pgext.day 2025Memory Management and Leaks in Postgres from pgext.day 2025
Memory Management and Leaks in Postgres from pgext.day 2025
Phil Eaton
 
From Vibe Coding to Vibe Testing - Complete PowerPoint Presentation
From Vibe Coding to Vibe Testing - Complete PowerPoint PresentationFrom Vibe Coding to Vibe Testing - Complete PowerPoint Presentation
From Vibe Coding to Vibe Testing - Complete PowerPoint Presentation
Shay Ginsbourg
 
GC Tuning: A Masterpiece in Performance Engineering
GC Tuning: A Masterpiece in Performance EngineeringGC Tuning: A Masterpiece in Performance Engineering
GC Tuning: A Masterpiece in Performance Engineering
Tier1 app
 
Why Tapitag Ranks Among the Best Digital Business Card Providers
Why Tapitag Ranks Among the Best Digital Business Card ProvidersWhy Tapitag Ranks Among the Best Digital Business Card Providers
Why Tapitag Ranks Among the Best Digital Business Card Providers
Tapitag
 
How to Troubleshoot 9 Types of OutOfMemoryError
How to Troubleshoot 9 Types of OutOfMemoryErrorHow to Troubleshoot 9 Types of OutOfMemoryError
How to Troubleshoot 9 Types of OutOfMemoryError
Tier1 app
 
Download 4k Video Downloader Crack Pre-Activated
Download 4k Video Downloader Crack Pre-ActivatedDownload 4k Video Downloader Crack Pre-Activated
Download 4k Video Downloader Crack Pre-Activated
Web Designer
 
Mobile Application Developer Dubai | Custom App Solutions by Ajath
Mobile Application Developer Dubai | Custom App Solutions by AjathMobile Application Developer Dubai | Custom App Solutions by Ajath
Mobile Application Developer Dubai | Custom App Solutions by Ajath
Ajath Infotech Technologies LLC
 
A Comprehensive Guide to CRM Software Benefits for Every Business Stage
A Comprehensive Guide to CRM Software Benefits for Every Business StageA Comprehensive Guide to CRM Software Benefits for Every Business Stage
A Comprehensive Guide to CRM Software Benefits for Every Business Stage
SynapseIndia
 
The-Future-is-Hybrid-Exploring-Azure’s-Role-in-Multi-Cloud-Strategies.pptx
The-Future-is-Hybrid-Exploring-Azure’s-Role-in-Multi-Cloud-Strategies.pptxThe-Future-is-Hybrid-Exploring-Azure’s-Role-in-Multi-Cloud-Strategies.pptx
The-Future-is-Hybrid-Exploring-Azure’s-Role-in-Multi-Cloud-Strategies.pptx
james brownuae
 
Serato DJ Pro Crack Latest Version 2025??
Serato DJ Pro Crack Latest Version 2025??Serato DJ Pro Crack Latest Version 2025??
Serato DJ Pro Crack Latest Version 2025??
Web Designer
 
Unit Two - Java Architecture and OOPS
Unit Two  -   Java Architecture and OOPSUnit Two  -   Java Architecture and OOPS
Unit Two - Java Architecture and OOPS
Nabin Dhakal
 
Orion Context Broker introduction 20250509
Orion Context Broker introduction 20250509Orion Context Broker introduction 20250509
Orion Context Broker introduction 20250509
Fermin Galan
 
Passive House Canada Conference 2025 Presentation [Final]_v4.ppt
Passive House Canada Conference 2025 Presentation [Final]_v4.pptPassive House Canada Conference 2025 Presentation [Final]_v4.ppt
Passive House Canada Conference 2025 Presentation [Final]_v4.ppt
IES VE
 
Robotic Process Automation (RPA) Software Development Services.pptx
Robotic Process Automation (RPA) Software Development Services.pptxRobotic Process Automation (RPA) Software Development Services.pptx
Robotic Process Automation (RPA) Software Development Services.pptx
julia smits
 
Artificial hand using embedded system.pptx
Artificial hand using embedded system.pptxArtificial hand using embedded system.pptx
Artificial hand using embedded system.pptx
bhoomigowda12345
 
Exchange Migration Tool- Shoviv Software
Exchange Migration Tool- Shoviv SoftwareExchange Migration Tool- Shoviv Software
Exchange Migration Tool- Shoviv Software
Shoviv Software
 
Buy vs. Build: Unlocking the right path for your training tech
Buy vs. Build: Unlocking the right path for your training techBuy vs. Build: Unlocking the right path for your training tech
Buy vs. Build: Unlocking the right path for your training tech
Rustici Software
 
Sequence Diagrams With Pictures (1).pptx
Sequence Diagrams With Pictures (1).pptxSequence Diagrams With Pictures (1).pptx
Sequence Diagrams With Pictures (1).pptx
aashrithakondapalli8
 
Troubleshooting JVM Outages – 3 Fortune 500 case studies
Troubleshooting JVM Outages – 3 Fortune 500 case studiesTroubleshooting JVM Outages – 3 Fortune 500 case studies
Troubleshooting JVM Outages – 3 Fortune 500 case studies
Tier1 app
 
Surviving a Downturn Making Smarter Portfolio Decisions with OnePlan - Webina...
Surviving a Downturn Making Smarter Portfolio Decisions with OnePlan - Webina...Surviving a Downturn Making Smarter Portfolio Decisions with OnePlan - Webina...
Surviving a Downturn Making Smarter Portfolio Decisions with OnePlan - Webina...
OnePlan Solutions
 
Memory Management and Leaks in Postgres from pgext.day 2025
Memory Management and Leaks in Postgres from pgext.day 2025Memory Management and Leaks in Postgres from pgext.day 2025
Memory Management and Leaks in Postgres from pgext.day 2025
Phil Eaton
 
From Vibe Coding to Vibe Testing - Complete PowerPoint Presentation
From Vibe Coding to Vibe Testing - Complete PowerPoint PresentationFrom Vibe Coding to Vibe Testing - Complete PowerPoint Presentation
From Vibe Coding to Vibe Testing - Complete PowerPoint Presentation
Shay Ginsbourg
 
GC Tuning: A Masterpiece in Performance Engineering
GC Tuning: A Masterpiece in Performance EngineeringGC Tuning: A Masterpiece in Performance Engineering
GC Tuning: A Masterpiece in Performance Engineering
Tier1 app
 
Why Tapitag Ranks Among the Best Digital Business Card Providers
Why Tapitag Ranks Among the Best Digital Business Card ProvidersWhy Tapitag Ranks Among the Best Digital Business Card Providers
Why Tapitag Ranks Among the Best Digital Business Card Providers
Tapitag
 
How to Troubleshoot 9 Types of OutOfMemoryError
How to Troubleshoot 9 Types of OutOfMemoryErrorHow to Troubleshoot 9 Types of OutOfMemoryError
How to Troubleshoot 9 Types of OutOfMemoryError
Tier1 app
 
Download 4k Video Downloader Crack Pre-Activated
Download 4k Video Downloader Crack Pre-ActivatedDownload 4k Video Downloader Crack Pre-Activated
Download 4k Video Downloader Crack Pre-Activated
Web Designer
 
Mobile Application Developer Dubai | Custom App Solutions by Ajath
Mobile Application Developer Dubai | Custom App Solutions by AjathMobile Application Developer Dubai | Custom App Solutions by Ajath
Mobile Application Developer Dubai | Custom App Solutions by Ajath
Ajath Infotech Technologies LLC
 
A Comprehensive Guide to CRM Software Benefits for Every Business Stage
A Comprehensive Guide to CRM Software Benefits for Every Business StageA Comprehensive Guide to CRM Software Benefits for Every Business Stage
A Comprehensive Guide to CRM Software Benefits for Every Business Stage
SynapseIndia
 
The-Future-is-Hybrid-Exploring-Azure’s-Role-in-Multi-Cloud-Strategies.pptx
The-Future-is-Hybrid-Exploring-Azure’s-Role-in-Multi-Cloud-Strategies.pptxThe-Future-is-Hybrid-Exploring-Azure’s-Role-in-Multi-Cloud-Strategies.pptx
The-Future-is-Hybrid-Exploring-Azure’s-Role-in-Multi-Cloud-Strategies.pptx
james brownuae
 
Serato DJ Pro Crack Latest Version 2025??
Serato DJ Pro Crack Latest Version 2025??Serato DJ Pro Crack Latest Version 2025??
Serato DJ Pro Crack Latest Version 2025??
Web Designer
 
Unit Two - Java Architecture and OOPS
Unit Two  -   Java Architecture and OOPSUnit Two  -   Java Architecture and OOPS
Unit Two - Java Architecture and OOPS
Nabin Dhakal
 
Orion Context Broker introduction 20250509
Orion Context Broker introduction 20250509Orion Context Broker introduction 20250509
Orion Context Broker introduction 20250509
Fermin Galan
 
Passive House Canada Conference 2025 Presentation [Final]_v4.ppt
Passive House Canada Conference 2025 Presentation [Final]_v4.pptPassive House Canada Conference 2025 Presentation [Final]_v4.ppt
Passive House Canada Conference 2025 Presentation [Final]_v4.ppt
IES VE
 
Robotic Process Automation (RPA) Software Development Services.pptx
Robotic Process Automation (RPA) Software Development Services.pptxRobotic Process Automation (RPA) Software Development Services.pptx
Robotic Process Automation (RPA) Software Development Services.pptx
julia smits
 
Artificial hand using embedded system.pptx
Artificial hand using embedded system.pptxArtificial hand using embedded system.pptx
Artificial hand using embedded system.pptx
bhoomigowda12345
 
Exchange Migration Tool- Shoviv Software
Exchange Migration Tool- Shoviv SoftwareExchange Migration Tool- Shoviv Software
Exchange Migration Tool- Shoviv Software
Shoviv Software
 
Buy vs. Build: Unlocking the right path for your training tech
Buy vs. Build: Unlocking the right path for your training techBuy vs. Build: Unlocking the right path for your training tech
Buy vs. Build: Unlocking the right path for your training tech
Rustici Software
 
Sequence Diagrams With Pictures (1).pptx
Sequence Diagrams With Pictures (1).pptxSequence Diagrams With Pictures (1).pptx
Sequence Diagrams With Pictures (1).pptx
aashrithakondapalli8
 
Troubleshooting JVM Outages – 3 Fortune 500 case studies
Troubleshooting JVM Outages – 3 Fortune 500 case studiesTroubleshooting JVM Outages – 3 Fortune 500 case studies
Troubleshooting JVM Outages – 3 Fortune 500 case studies
Tier1 app
 

Analysis of Algorithms - 5

  • 1. 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
  • 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
  翻译: