SlideShare une entreprise Scribd logo
1  sur  12
Télécharger pour lire hors ligne
simone tino
Algorithms &
Complexity evaluation
Discoverying
Binary Search Trees
of Almost Optimal
Height

@ Università di Catania #20/11/2012
so... what’s this all about?

Introducing
SBB(k) trees
Before getting to SBB(k) trees, we
really have a long way to go... What
about a shortcut?

AVL-Tree

(a,b)-Tree

SBB(k)
Tree

Binary
Search Tree

B-Tree

SBB
Tree

SBB-tree and SBB(k)-tree introduce
the concept of “pseudo-node”!
Presentation by Simone Tino - All rights reserved. Authored from October 2012 to November 2012 - University of Catania - Faculty of Computer Science - Algoritmi e Complessità
some definitions...

Matrioska-like definitions, let’s start
from the most inner one...

Optimally balanced
The difference between
its maximum and minimum
heights <= 1

Introducing important
concepts: Pseudo-Node
Minimum
height

Maximum
height

Presentation by Simone Tino - All rights reserved. Authored from October 2012 to November 2012 - University of Catania - Faculty of Computer Science - Algoritmi e Complessità
Let’s open the box and
see what’s inside...

Defining SBB(k)-trees
SBB(k)-tree is a binary-tree which
satisfies the following 3 criteria...
The

Pseudo-Root

is optimally

balanced and has a maximum
height <= (k+1).
All other

Pseudo-Nodes

have a

minimum height >= (k) and a
maximum height <= (k+1).
The number of

Pseudo-Nodes

on the path

from the root to a leaf is the same for all leaves.
Presentation by Simone Tino - All rights reserved. Authored from October 2012 to November 2012 - University of Catania - Faculty of Computer Science - Algoritmi e Complessità
47

The importance of k

Let’s draw some
trees...

35

64

19
9

50

40
28

38

44

48

69
52

66

77

47

35

64
40

k -> k++
19
9

38
28

44

50
48

69
52

66

77

What happens when k
increases?

Presentation by Simone Tino - All rights reserved. Authored from October 2012 to November 2012 - University of Catania - Faculty of Computer Science - Algoritmi e Complessità
Caging
SBB(k)-trees?

Height upper-bound
START

h ( ab-tree ) 1+ log a

h ( SBB(k)-tree )

n +1
2

= 1+

log ( n + 1) 1
log ( 2 k )

log ( n + 1) + h ( ab-tree )
log ( n + 1) + 1+
1+

1
k

log ( n + 1) 1
log ( 2 k )

log ( n + 1) + 1

1
k

h ( SBB(k)-tree )

1
1+
k

log ( n + 1)

Presentation by Simone Tino - All rights reserved. Authored from October 2012 to November 2012 - University of Catania - Faculty of Computer Science - Algoritmi e Complessità
Maintenance algorithms

ops.balance

ops.coBalance

Merging, cutting,
rotating... the bricks
of SBB(k)-trees

ops.split

ops.join

Presentation by Simone Tino - All rights reserved. Authored from October 2012 to November 2012 - University of Catania - Faculty of Computer Science - Algoritmi e Complessità
Update algorithms
ops.insertion
Inserting a node in the tree.

Analyzing algorithms for
insertion and deletion in
SBB(k)-trees

int ops.insertion(pn P, int c) {
return (c==0) ? ops.balance(P,null) :
/*(c==1)*/ ops.split(P,null);
}

ops.deletion
Deleting a node in the tree.
int ops.deletion(pn P, pn S, int c) {
return (c==0x00) ? ops.balance(P,S) :
ops.rotation() +
(c==0x10) ? ops.coBalance(P,S) :
/*(c==0x11)*/ ops.join(P,S);
}

Presentation by Simone Tino - All rights reserved. Authored from October 2012 to November 2012 - University of Catania - Faculty of Computer Science - Algoritmi e Complessità
Inspecting ops.balance
and most important issues

Restructuring Work
A very important
operation is
Restructuring.

It is needed to keep the
tree a SBB(k)-tree.
Restructuring is
performed by the
Balance operation.

Restructuring Work
=
ops.balance

insertion

2 k+2
2P

max ( ll ( P ) ,rl ( P ))

log ( P + 1)

2k 4

deletion

3 2 k+1 2k 7

Presentation by Simone Tino - All rights reserved. Authored from October 2012 to November 2012 - University of Catania - Faculty of Computer Science - Algoritmi e Complessità
Binding k to n and
seeing what happens

Improving height
log log ( n + 1)

log log ( 3n )

k

Recalling dynamic arrays,
we can create a range for k

At the begging, we proved the upper-bound. By
tuning k, we improve the upper-bound

h ( SBB(k)-tree )

k = O ( log log n )

O ( log n )

1+

1
k

1+

1
log log ( n + 1)

log ( n + 1)
log ( n + 1)

( )

O 2 k Restructuring
work

Presentation by Simone Tino - All rights reserved. Authored from October 2012 to November 2012 - University of Catania - Faculty of Computer Science - Algoritmi e Complessità
An efficient application

What’s this? Am I
seeing double ?!?

Keeping two SBB(k)-trees
synchronized
Ghosting one tree on
the other one
Hiding rebuilding
work

Presentation by Simone Tino - All rights reserved. Authored from October 2012 to November 2012 - University of Catania - Faculty of Computer Science - Algoritmi e Complessità
the end
thank you
by

simone
tino

Contenu connexe

Dernier

1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIShubhangi Sonawane
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfChris Hunter
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 

Dernier (20)

1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 

En vedette

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
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
 

En vedette (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
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...
 

Binary Search Trees of Almost Optimal Height

  • 1. simone tino Algorithms & Complexity evaluation Discoverying Binary Search Trees of Almost Optimal Height @ Università di Catania #20/11/2012
  • 2. so... what’s this all about? Introducing SBB(k) trees Before getting to SBB(k) trees, we really have a long way to go... What about a shortcut? AVL-Tree (a,b)-Tree SBB(k) Tree Binary Search Tree B-Tree SBB Tree SBB-tree and SBB(k)-tree introduce the concept of “pseudo-node”! Presentation by Simone Tino - All rights reserved. Authored from October 2012 to November 2012 - University of Catania - Faculty of Computer Science - Algoritmi e Complessità
  • 3. some definitions... Matrioska-like definitions, let’s start from the most inner one... Optimally balanced The difference between its maximum and minimum heights <= 1 Introducing important concepts: Pseudo-Node Minimum height Maximum height Presentation by Simone Tino - All rights reserved. Authored from October 2012 to November 2012 - University of Catania - Faculty of Computer Science - Algoritmi e Complessità
  • 4. Let’s open the box and see what’s inside... Defining SBB(k)-trees SBB(k)-tree is a binary-tree which satisfies the following 3 criteria... The Pseudo-Root is optimally balanced and has a maximum height <= (k+1). All other Pseudo-Nodes have a minimum height >= (k) and a maximum height <= (k+1). The number of Pseudo-Nodes on the path from the root to a leaf is the same for all leaves. Presentation by Simone Tino - All rights reserved. Authored from October 2012 to November 2012 - University of Catania - Faculty of Computer Science - Algoritmi e Complessità
  • 5. 47 The importance of k Let’s draw some trees... 35 64 19 9 50 40 28 38 44 48 69 52 66 77 47 35 64 40 k -> k++ 19 9 38 28 44 50 48 69 52 66 77 What happens when k increases? Presentation by Simone Tino - All rights reserved. Authored from October 2012 to November 2012 - University of Catania - Faculty of Computer Science - Algoritmi e Complessità
  • 6. Caging SBB(k)-trees? Height upper-bound START h ( ab-tree ) 1+ log a h ( SBB(k)-tree ) n +1 2 = 1+ log ( n + 1) 1 log ( 2 k ) log ( n + 1) + h ( ab-tree ) log ( n + 1) + 1+ 1+ 1 k log ( n + 1) 1 log ( 2 k ) log ( n + 1) + 1 1 k h ( SBB(k)-tree ) 1 1+ k log ( n + 1) Presentation by Simone Tino - All rights reserved. Authored from October 2012 to November 2012 - University of Catania - Faculty of Computer Science - Algoritmi e Complessità
  • 7. Maintenance algorithms ops.balance ops.coBalance Merging, cutting, rotating... the bricks of SBB(k)-trees ops.split ops.join Presentation by Simone Tino - All rights reserved. Authored from October 2012 to November 2012 - University of Catania - Faculty of Computer Science - Algoritmi e Complessità
  • 8. Update algorithms ops.insertion Inserting a node in the tree. Analyzing algorithms for insertion and deletion in SBB(k)-trees int ops.insertion(pn P, int c) { return (c==0) ? ops.balance(P,null) : /*(c==1)*/ ops.split(P,null); } ops.deletion Deleting a node in the tree. int ops.deletion(pn P, pn S, int c) { return (c==0x00) ? ops.balance(P,S) : ops.rotation() + (c==0x10) ? ops.coBalance(P,S) : /*(c==0x11)*/ ops.join(P,S); } Presentation by Simone Tino - All rights reserved. Authored from October 2012 to November 2012 - University of Catania - Faculty of Computer Science - Algoritmi e Complessità
  • 9. Inspecting ops.balance and most important issues Restructuring Work A very important operation is Restructuring. It is needed to keep the tree a SBB(k)-tree. Restructuring is performed by the Balance operation. Restructuring Work = ops.balance insertion 2 k+2 2P max ( ll ( P ) ,rl ( P )) log ( P + 1) 2k 4 deletion 3 2 k+1 2k 7 Presentation by Simone Tino - All rights reserved. Authored from October 2012 to November 2012 - University of Catania - Faculty of Computer Science - Algoritmi e Complessità
  • 10. Binding k to n and seeing what happens Improving height log log ( n + 1) log log ( 3n ) k Recalling dynamic arrays, we can create a range for k At the begging, we proved the upper-bound. By tuning k, we improve the upper-bound h ( SBB(k)-tree ) k = O ( log log n ) O ( log n ) 1+ 1 k 1+ 1 log log ( n + 1) log ( n + 1) log ( n + 1) ( ) O 2 k Restructuring work Presentation by Simone Tino - All rights reserved. Authored from October 2012 to November 2012 - University of Catania - Faculty of Computer Science - Algoritmi e Complessità
  • 11. An efficient application What’s this? Am I seeing double ?!? Keeping two SBB(k)-trees synchronized Ghosting one tree on the other one Hiding rebuilding work Presentation by Simone Tino - All rights reserved. Authored from October 2012 to November 2012 - University of Catania - Faculty of Computer Science - Algoritmi e Complessità