SlideShare a Scribd company logo
1 of 25
Download to read offline
AA Trees
Red-Black trees simplified
20PT25 – Rhubanraj P 20PT27 – Sai Shreehamsini N
November 21, 2021
PSG College of Technology
1
Table of contents
1. Introduction
2. Recapitulation – Balanced BST
3. Properties of AA Trees
in terms of RB Trees
4. Pseduo-nodes
5. Properties of AA Trees
in terms of Pseudo-nodes
6. Balancing Operations
2
Introduction
How is the simplicity achieved?
• Traditional balancing methods replaced by Skew and Split
• Balance information is represented as one bit per node
• Deletion is done using two global pointers
Is there a tradeoff?
Simpler and clearer but slower than Red-Black trees.
3
Recapitulation – Balanced BST
Balanced BST
Height?
The maximum level of its leaves. Also known as the depth.
Balance factor?
Balance of a node is defined as the height of its left subtree minus
the height of the right subtree
When does the tree become balanced?
Balance factor of every node is either -1, 0 or 1.
4
Properties of AA Trees
in terms of RB Trees
Properties
• Every node in the AA Tree is colored either Red or Black
• The Root should be Black
• If a node is a red node, its children must be black.
• All Simple paths from any node x to its descendant leaf nodes
must contain the same number of black nodes.
• Left children may not be red.
5
Properties (Cond...)
• Leaf nodes are nodes that contain no black children.
• Level of a Node.
• 1, if it is a leaf Node.
• Level of the parent, if the node is red.
• One less than the level of the parent, if the node is black.
• Red children are considered to be in the same level as its parent.
6
RB Trees - AA Trees Example
4
2
1 3
10
6
5 8
7 9
12
11 13
Figure 1: An AA Tree (RB Tree Depiction)
7
Pseduo-nodes
Abstraction using pseudo-nodes
• Pseudo-nodes are used in a binary search tree to fake a
multi-way search tree
• Red-black abstraction is removed; ”Red” links considered
horizontal and ”black” links considered vertical
• Horizontal links correspond to a single pseudo-node
• Vertical links correspond to two pseudo-nodes
8
Visualization – Pseudo-nodes
4- - - - - - - 10
2
1 3
6 − − − − − 8
5 7 9
12
11 13
Figure 2: An AA Tree (Pseudo-Nodes Depection)
9
Visualization – Pseudo-nodes
4, 3
2, 2
1, 1 3, 1
10, 3
6, 2
5, 1 8, 2
7, 1 9, 1
12, 2
11, 1 13, 1
Figure 3: Binary Search Tree of Pseudo-Nodes
10
Properties of AA Trees
in terms of Pseudo-nodes
Properties
1. Every path contains the same number of pseudo-nodes.
2. A left child may not have the same level as its parent.
• Alternatively, horizontal left links are not allowed.
3. Two right children with the same level as the parent are not
allowed.
• Alternatively, two consecutive horizontal links are not allowed.
11
Balancing Operations
Balancing Operations – Skew
What does the skew operation do?
A skew removes left horizontal links by rotating right at the parent
Is there any change to the levels?
No, because the operation simply turns a left horizontal link into a
right horizontal link.
12
Visualization – Skew
d, 2
b, 2
a, 1 c, 1
e, 1
Figure 4: Original Tree
13
Visualization – Skew
b, 2
a, 1 d, 2
c, 1 e, 1
Figure 5: After Skew
14
Balancing Operations – Split
Why do we need the split operation?
A skew could create two consecutive right horizontal links, which is
not allowed.
What does the operation do?
A split removes consecutive horizontal links by rotating left and
increasing the level of the parent
Is there any change in the levels?
Yes, a split needs to change the level of a single node because if a
skew is made first, a split will negate the changes made by doing the
inverse of a skew. The new parent is forced to a higher level.
15
Visualization – Split
b, 2
a, 1 d, 2
c, 1 e, 2
Figure 6: Original Tree
16
Visualization – Split
d, 3
b, 2
a, 1 c, 1
e, 2
Figure 7: After Split
17
Visualization – Split
b, 2
a, 1 d, 2
c, 1 e, 2
Figure 8: Original Tree
18
Useful Links
• AA Trees Visualizer
• AA Trees Tutorial
19

More Related Content

Recently uploaded

TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...Nguyen Thanh Tu Collection
 
Exploring Gemini AI and Integration with MuleSoft | MuleSoft Mysore Meetup #45
Exploring Gemini AI and Integration with MuleSoft | MuleSoft Mysore Meetup #45Exploring Gemini AI and Integration with MuleSoft | MuleSoft Mysore Meetup #45
Exploring Gemini AI and Integration with MuleSoft | MuleSoft Mysore Meetup #45MysoreMuleSoftMeetup
 
Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinhĐề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinhleson0603
 
How to Analyse Profit of a Sales Order in Odoo 17
How to Analyse Profit of a Sales Order in Odoo 17How to Analyse Profit of a Sales Order in Odoo 17
How to Analyse Profit of a Sales Order in Odoo 17Celine George
 
An Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge AppAn Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge AppCeline George
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjMohammed Sikander
 
The Liver & Gallbladder (Anatomy & Physiology).pptx
The Liver &  Gallbladder (Anatomy & Physiology).pptxThe Liver &  Gallbladder (Anatomy & Physiology).pptx
The Liver & Gallbladder (Anatomy & Physiology).pptxVishal Singh
 
8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital ManagementMBA Assignment Experts
 
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...Gary Wood
 
Championnat de France de Tennis de table/
Championnat de France de Tennis de table/Championnat de France de Tennis de table/
Championnat de France de Tennis de table/siemaillard
 
PSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxPSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxMarlene Maheu
 
Graduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxGraduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxneillewis46
 
How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17Celine George
 
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUMDEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUMELOISARIVERA8
 
Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...EduSkills OECD
 
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSean M. Fox
 

Recently uploaded (20)

TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
 
Exploring Gemini AI and Integration with MuleSoft | MuleSoft Mysore Meetup #45
Exploring Gemini AI and Integration with MuleSoft | MuleSoft Mysore Meetup #45Exploring Gemini AI and Integration with MuleSoft | MuleSoft Mysore Meetup #45
Exploring Gemini AI and Integration with MuleSoft | MuleSoft Mysore Meetup #45
 
Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinhĐề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
 
How to Analyse Profit of a Sales Order in Odoo 17
How to Analyse Profit of a Sales Order in Odoo 17How to Analyse Profit of a Sales Order in Odoo 17
How to Analyse Profit of a Sales Order in Odoo 17
 
An Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge AppAn Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge App
 
Mattingly "AI & Prompt Design: Named Entity Recognition"
Mattingly "AI & Prompt Design: Named Entity Recognition"Mattingly "AI & Prompt Design: Named Entity Recognition"
Mattingly "AI & Prompt Design: Named Entity Recognition"
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
 
The Liver & Gallbladder (Anatomy & Physiology).pptx
The Liver &  Gallbladder (Anatomy & Physiology).pptxThe Liver &  Gallbladder (Anatomy & Physiology).pptx
The Liver & Gallbladder (Anatomy & Physiology).pptx
 
8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management
 
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
 
Championnat de France de Tennis de table/
Championnat de France de Tennis de table/Championnat de France de Tennis de table/
Championnat de France de Tennis de table/
 
“O BEIJO” EM ARTE .
“O BEIJO” EM ARTE                       .“O BEIJO” EM ARTE                       .
“O BEIJO” EM ARTE .
 
PSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxPSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptx
 
Including Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdfIncluding Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdf
 
Graduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxGraduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptx
 
How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17
 
IPL Online Quiz by Pragya; Question Set.
IPL Online Quiz by Pragya; Question Set.IPL Online Quiz by Pragya; Question Set.
IPL Online Quiz by Pragya; Question Set.
 
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUMDEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
 
Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...
 
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
 

Featured

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 

Featured (20)

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 

AA trees (20PT25 and 20PT27 - ADS Presentation)

  • 1. AA Trees Red-Black trees simplified 20PT25 – Rhubanraj P 20PT27 – Sai Shreehamsini N November 21, 2021 PSG College of Technology 1
  • 2. Table of contents 1. Introduction 2. Recapitulation – Balanced BST 3. Properties of AA Trees in terms of RB Trees 4. Pseduo-nodes 5. Properties of AA Trees in terms of Pseudo-nodes 6. Balancing Operations 2
  • 4. How is the simplicity achieved? • Traditional balancing methods replaced by Skew and Split • Balance information is represented as one bit per node • Deletion is done using two global pointers Is there a tradeoff? Simpler and clearer but slower than Red-Black trees. 3
  • 6. Balanced BST Height? The maximum level of its leaves. Also known as the depth. Balance factor? Balance of a node is defined as the height of its left subtree minus the height of the right subtree When does the tree become balanced? Balance factor of every node is either -1, 0 or 1. 4
  • 7. Properties of AA Trees in terms of RB Trees
  • 8. Properties • Every node in the AA Tree is colored either Red or Black • The Root should be Black • If a node is a red node, its children must be black. • All Simple paths from any node x to its descendant leaf nodes must contain the same number of black nodes. • Left children may not be red. 5
  • 9. Properties (Cond...) • Leaf nodes are nodes that contain no black children. • Level of a Node. • 1, if it is a leaf Node. • Level of the parent, if the node is red. • One less than the level of the parent, if the node is black. • Red children are considered to be in the same level as its parent. 6
  • 10. RB Trees - AA Trees Example 4 2 1 3 10 6 5 8 7 9 12 11 13 Figure 1: An AA Tree (RB Tree Depiction) 7
  • 12. Abstraction using pseudo-nodes • Pseudo-nodes are used in a binary search tree to fake a multi-way search tree • Red-black abstraction is removed; ”Red” links considered horizontal and ”black” links considered vertical • Horizontal links correspond to a single pseudo-node • Vertical links correspond to two pseudo-nodes 8
  • 13. Visualization – Pseudo-nodes 4- - - - - - - 10 2 1 3 6 − − − − − 8 5 7 9 12 11 13 Figure 2: An AA Tree (Pseudo-Nodes Depection) 9
  • 14. Visualization – Pseudo-nodes 4, 3 2, 2 1, 1 3, 1 10, 3 6, 2 5, 1 8, 2 7, 1 9, 1 12, 2 11, 1 13, 1 Figure 3: Binary Search Tree of Pseudo-Nodes 10
  • 15. Properties of AA Trees in terms of Pseudo-nodes
  • 16. Properties 1. Every path contains the same number of pseudo-nodes. 2. A left child may not have the same level as its parent. • Alternatively, horizontal left links are not allowed. 3. Two right children with the same level as the parent are not allowed. • Alternatively, two consecutive horizontal links are not allowed. 11
  • 18. Balancing Operations – Skew What does the skew operation do? A skew removes left horizontal links by rotating right at the parent Is there any change to the levels? No, because the operation simply turns a left horizontal link into a right horizontal link. 12
  • 19. Visualization – Skew d, 2 b, 2 a, 1 c, 1 e, 1 Figure 4: Original Tree 13
  • 20. Visualization – Skew b, 2 a, 1 d, 2 c, 1 e, 1 Figure 5: After Skew 14
  • 21. Balancing Operations – Split Why do we need the split operation? A skew could create two consecutive right horizontal links, which is not allowed. What does the operation do? A split removes consecutive horizontal links by rotating left and increasing the level of the parent Is there any change in the levels? Yes, a split needs to change the level of a single node because if a skew is made first, a split will negate the changes made by doing the inverse of a skew. The new parent is forced to a higher level. 15
  • 22. Visualization – Split b, 2 a, 1 d, 2 c, 1 e, 2 Figure 6: Original Tree 16
  • 23. Visualization – Split d, 3 b, 2 a, 1 c, 1 e, 2 Figure 7: After Split 17
  • 24. Visualization – Split b, 2 a, 1 d, 2 c, 1 e, 2 Figure 8: Original Tree 18
  • 25. Useful Links • AA Trees Visualizer • AA Trees Tutorial 19