SlideShare uma empresa Scribd logo
1 de 11
NADAR SARASWATHI COLLEGE OF ARTS AND SCIENCE
Name : P. Gayathri
Class : I M.Sc (CS)
Topic : Optimal binary search trees
Optimal binary search tree
an optimal binary search tree (Optimal BST), sometimes called
a weight-balanced binary tree , is a binary search tree which provides the
smallest possible search time (or expected search time) for a given
sequence of accesses (or access probabilities).
Optimal BSTs are generally divided into two types:
static
 dynamic.
 In the static optimality problem, the tree cannot be modified after it has
been constructed. In this case, there exists some particular layout of the
nodes of the tree which provides the smallest expected search time for the
given access probabilities. Various algorithms exist to construct or
approximate the statically optimal tree given the information on the
access probabilities of the elements.
 In the dynamic optimality problem, the tree can be modified at any time,
typically by permitting tree rotations. The tree is considered to have a
cursor starting at the root which it can move or use to perform
modifications. In this case, there exists some minimal-cost sequence of
these operations which causes the cursor to visit every node in the target
access sequence in order. The splay tree is conjectured to have a
constant competitive ratio compared to the dynamically optimal tree in all
cases, though this has not yet been proven.
If the keys are 10, 20, 30, 40, 50, 60, 70
Example:
For example: 10, 20, 30 are the keys, and the following are the binary search trees that can be
made out from these keys.
The Formula for calculating the number of trees:
When we use the above formula, then it is found that total 5
number of trees can be created.
The cost required for searching an element depends on the comparisons to be made to search
an element. Now, we will calculate the average cost of time of the above binary search trees.
In the above tree, total number of 3 comparisons can be made. The average number of
comparisons can be made as:
In the above tree, the average number of comparisons that can be made as:
In the above tree, the total number of comparisons can be made as 3. Therefore, the average
number of comparisons that can be made as:
In the above tree, the total number of comparisons can be made as 3.
Therefore, the average number of comparisons that can be made as:
 In the third case, the number of comparisons is less because the height of the
tree is less, so it's a balanced binary search tree.
 Till now, we read about the height-balanced binary search tree. To find the
optimal binary search tree, we will determine the frequency of searching a
key.
 Let's assume that frequencies associated with the keys 10, 20, 30 are 3, 2, 5.
 The above trees have different frequencies. The tree with the lowest
frequency would be considered the optimal binary search tree. The tree with
the frequency 17 is the lowest, so it would be considered as the optimal
binary search tree.
THANK YOU…

Mais conteúdo relacionado

Semelhante a gayathri23.pptx

Humans, it would seem, have a great love of categorizing, organi
Humans, it would seem, have a great love of categorizing, organiHumans, it would seem, have a great love of categorizing, organi
Humans, it would seem, have a great love of categorizing, organi
NarcisaBrandenburg70
 
A Survey of Modern Data Classification Techniques
A Survey of Modern Data Classification TechniquesA Survey of Modern Data Classification Techniques
A Survey of Modern Data Classification Techniques
ijsrd.com
 
Blast fasta
Blast fastaBlast fasta
Blast fasta
yaghava
 

Semelhante a gayathri23.pptx (20)

Decision Tree.pptx
Decision Tree.pptxDecision Tree.pptx
Decision Tree.pptx
 
Circular Linked List.pptx
Circular Linked List.pptxCircular Linked List.pptx
Circular Linked List.pptx
 
ML_Unit_1_Part_C
ML_Unit_1_Part_CML_Unit_1_Part_C
ML_Unit_1_Part_C
 
Data Science - Part V - Decision Trees & Random Forests
Data Science - Part V - Decision Trees & Random Forests Data Science - Part V - Decision Trees & Random Forests
Data Science - Part V - Decision Trees & Random Forests
 
20211229120253D6323_PERT 06_ Ensemble Learning.pptx
20211229120253D6323_PERT 06_ Ensemble Learning.pptx20211229120253D6323_PERT 06_ Ensemble Learning.pptx
20211229120253D6323_PERT 06_ Ensemble Learning.pptx
 
Pattern Discovery Using Apriori and Ch-Search Algorithm
 Pattern Discovery Using Apriori and Ch-Search Algorithm Pattern Discovery Using Apriori and Ch-Search Algorithm
Pattern Discovery Using Apriori and Ch-Search Algorithm
 
An improvised frequent pattern tree
An improvised frequent pattern treeAn improvised frequent pattern tree
An improvised frequent pattern tree
 
Humans, it would seem, have a great love of categorizing, organi
Humans, it would seem, have a great love of categorizing, organiHumans, it would seem, have a great love of categorizing, organi
Humans, it would seem, have a great love of categorizing, organi
 
A Survey of Modern Data Classification Techniques
A Survey of Modern Data Classification TechniquesA Survey of Modern Data Classification Techniques
A Survey of Modern Data Classification Techniques
 
Desicion tree and neural networks
Desicion tree and neural networksDesicion tree and neural networks
Desicion tree and neural networks
 
Clustering - K-Means, DBSCAN
Clustering - K-Means, DBSCANClustering - K-Means, DBSCAN
Clustering - K-Means, DBSCAN
 
Presentations, Documents, Infographics, and more
Presentations, Documents, Infographics, and morePresentations, Documents, Infographics, and more
Presentations, Documents, Infographics, and more
 
Introduction to Clustering . pptx
Introduction    to     Clustering . pptxIntroduction    to     Clustering . pptx
Introduction to Clustering . pptx
 
Machine learning basics using trees algorithm (Random forest, Gradient Boosting)
Machine learning basics using trees algorithm (Random forest, Gradient Boosting)Machine learning basics using trees algorithm (Random forest, Gradient Boosting)
Machine learning basics using trees algorithm (Random forest, Gradient Boosting)
 
Eurolan 2005 Pedersen
Eurolan 2005 PedersenEurolan 2005 Pedersen
Eurolan 2005 Pedersen
 
Blast fasta
Blast fastaBlast fasta
Blast fasta
 
Mis End Term Exam Theory Concepts
Mis End Term Exam Theory ConceptsMis End Term Exam Theory Concepts
Mis End Term Exam Theory Concepts
 
NEW SEQUENCE ALIGNMENT ALGORITHM USING AI RULES AND DYNAMIC SEEDS
NEW SEQUENCE ALIGNMENT ALGORITHM USING AI RULES AND DYNAMIC SEEDSNEW SEQUENCE ALIGNMENT ALGORITHM USING AI RULES AND DYNAMIC SEEDS
NEW SEQUENCE ALIGNMENT ALGORITHM USING AI RULES AND DYNAMIC SEEDS
 
NEW SEQUENCE ALIGNMENT ALGORITHM USING AI RULES AND DYNAMIC SEEDS
NEW SEQUENCE ALIGNMENT ALGORITHM USING AI RULES AND DYNAMIC SEEDSNEW SEQUENCE ALIGNMENT ALGORITHM USING AI RULES AND DYNAMIC SEEDS
NEW SEQUENCE ALIGNMENT ALGORITHM USING AI RULES AND DYNAMIC SEEDS
 
NEW SEQUENCE ALIGNMENT ALGORITHM USING AI RULES AND DYNAMIC SEEDS
NEW SEQUENCE ALIGNMENT ALGORITHM USING AI RULES AND DYNAMIC SEEDSNEW SEQUENCE ALIGNMENT ALGORITHM USING AI RULES AND DYNAMIC SEEDS
NEW SEQUENCE ALIGNMENT ALGORITHM USING AI RULES AND DYNAMIC SEEDS
 

Mais de GayathriP95 (12)

cloud computing.pptx
cloud computing.pptxcloud computing.pptx
cloud computing.pptx
 
ML.pptx
ML.pptxML.pptx
ML.pptx
 
women.pptx
women.pptxwomen.pptx
women.pptx
 
IOT.pptx
IOT.pptxIOT.pptx
IOT.pptx
 
dip.pptx
dip.pptxdip.pptx
dip.pptx
 
cloud computing.pptx
cloud computing.pptxcloud computing.pptx
cloud computing.pptx
 
gayathrinosql.pptx
gayathrinosql.pptxgayathrinosql.pptx
gayathrinosql.pptx
 
crypto.pptx
crypto.pptxcrypto.pptx
crypto.pptx
 
dos.pptx
dos.pptxdos.pptx
dos.pptx
 
python.pptx
python.pptxpython.pptx
python.pptx
 
gayathri.p.pptx
gayathri.p.pptxgayathri.p.pptx
gayathri.p.pptx
 
gayathri.pptx
gayathri.pptxgayathri.pptx
gayathri.pptx
 

Último

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
kauryashika82
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
MateoGardella
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
MateoGardella
 
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
QucHHunhnh
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 

Último (20)

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
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.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
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
 
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
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
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
 

gayathri23.pptx

  • 1. NADAR SARASWATHI COLLEGE OF ARTS AND SCIENCE Name : P. Gayathri Class : I M.Sc (CS) Topic : Optimal binary search trees
  • 2. Optimal binary search tree an optimal binary search tree (Optimal BST), sometimes called a weight-balanced binary tree , is a binary search tree which provides the smallest possible search time (or expected search time) for a given sequence of accesses (or access probabilities). Optimal BSTs are generally divided into two types: static  dynamic.
  • 3.  In the static optimality problem, the tree cannot be modified after it has been constructed. In this case, there exists some particular layout of the nodes of the tree which provides the smallest expected search time for the given access probabilities. Various algorithms exist to construct or approximate the statically optimal tree given the information on the access probabilities of the elements.  In the dynamic optimality problem, the tree can be modified at any time, typically by permitting tree rotations. The tree is considered to have a cursor starting at the root which it can move or use to perform modifications. In this case, there exists some minimal-cost sequence of these operations which causes the cursor to visit every node in the target access sequence in order. The splay tree is conjectured to have a constant competitive ratio compared to the dynamically optimal tree in all cases, though this has not yet been proven.
  • 4. If the keys are 10, 20, 30, 40, 50, 60, 70 Example:
  • 5. For example: 10, 20, 30 are the keys, and the following are the binary search trees that can be made out from these keys. The Formula for calculating the number of trees: When we use the above formula, then it is found that total 5 number of trees can be created.
  • 6. The cost required for searching an element depends on the comparisons to be made to search an element. Now, we will calculate the average cost of time of the above binary search trees. In the above tree, total number of 3 comparisons can be made. The average number of comparisons can be made as:
  • 7. In the above tree, the average number of comparisons that can be made as:
  • 8. In the above tree, the total number of comparisons can be made as 3. Therefore, the average number of comparisons that can be made as:
  • 9. In the above tree, the total number of comparisons can be made as 3. Therefore, the average number of comparisons that can be made as:
  • 10.  In the third case, the number of comparisons is less because the height of the tree is less, so it's a balanced binary search tree.  Till now, we read about the height-balanced binary search tree. To find the optimal binary search tree, we will determine the frequency of searching a key.  Let's assume that frequencies associated with the keys 10, 20, 30 are 3, 2, 5.  The above trees have different frequencies. The tree with the lowest frequency would be considered the optimal binary search tree. The tree with the frequency 17 is the lowest, so it would be considered as the optimal binary search tree.