+ 1

What is optimal binary tree's algorithm?

A binary search tree that is the having the least cost for successful and unsuccessful search!

20th Feb 2018, 5:10 PM
Lakshay Bhalla
Lakshay Bhalla - avatar
2 Respuestas
+ 1
I did not got your question exactly but what I understood is that you are asking for is the best and worst case of BST. The best case for BST is O(1) that is, the required element is the first element of the tree i.e. ROOT. The worst case is O(log n) where n is the total number of elements. It is log n because in a binary tree we divide the whole tree in three parts Root, Left Subtree (which is lesser than Root) and Right Subtree (which is greater than Root). For example is the required element is greater than root node we would probably search the right subtree.
21st Feb 2018, 9:12 AM
ABDUL MANAN
ABDUL MANAN - avatar
0
The answer provided by you mr. abdul is good but it is not relevant to the optimal binary search tree.
21st Feb 2018, 9:27 AM
Lakshay Bhalla
Lakshay Bhalla - avatar