Give a basic algorithm for searching a binary search tree.

Answer

1. if the tree is empty, then the target is not in the tree, end search
2. if the tree is not empty, the target is in the tree
3. check if the target is in the root item
4. if target is not in the root item, check if target is smaller than the root’s value
5. if target is smaller than the root’s value, search the left subtree
6. else, search the right subtree

All data-structures Questions

Ask your interview questions on data-structures

Write Your comment or Questions if you want the answers on data-structures from data-structures Experts
Name* :
Email Id* :
Mob no* :
Question
Or
Comment* :
 





Disclimer: PCDS.CO.IN not responsible for any content, information, data or any feature of website. If you are using this website then its your own responsibility to understand the content of the website

--------- Tutorials ---