Optimal Binary Search Tree
Dr. P. Subathra
Prof/ IT
KAMARAJ College of Engg. & Tech
(AUTONOMOUS)
Madurai
Tamil Nadu
India
•Ifprobabilitiesofsearchingforelementsofasetare
known—e.g.,fromaccumulateddataaboutpast
searches—itisnaturaltoposeaquestionaboutan
optimalbinarysearchtreeforwhichtheaverage
numberofcomparisonsinasearchisthesmallest
possible.
•welimitourdiscussiontominimizingtheaverage
numberofcomparisonsinasuccessfulsearch.
•Themethodcanbeextendedtoincludeunsuccessful
searchesaswell.
Dr. P. Subathra, KAMARAJ College of Engg &
Tech (AUTONOMOUS), Madurai,
Tamil Nadu, India
2
•The total number of binary search trees with n
keys is equal to the nth Catalan number
Dr. P. Subathra, KAMARAJ College of Engg &
Tech (AUTONOMOUS), Madurai,
Tamil Nadu, India
3
Dr. P. Subathra, KAMARAJ College of Engg &
Tech (AUTONOMOUS), Madurai,
Tamil Nadu, India
4
OBST CREATION
(j-i)=0
Item 1 2 3 4
Key10203040
Freq4 2 6 3
ij0 1 2 3 4
0
1
2
3
4
Dr. P. Subathra, KAMARAJ College of Engg &
Tech (AUTONOMOUS), Madurai,
Tamil Nadu, India
5