How would you check if a binary tree is BST or not ? Write a program.



How would you check if a binary tree is BST or not ? Write a program...

Answer / Sumaira Anam

To check if a binary tree is a BST (Binary Search Tree), you can perform an inorder traversal and check that the current element is greater than its left child and less than its right child. A recursive function can be written to do this. Here's an example of such a program:

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Data Structures Interview Questions

what is the different between B-tree and B+ tree.

8 Answers   Syntel,


Can map contain duplicate keys?

1 Answers  


How does bogo sort work?

1 Answers  


What should be done in the base case for this recursive problem?

1 Answers  


Which is the parent class of sortedset<e> class?

1 Answers  


Parenthesis are never needed in prefix or postfix expressions. Why?

13 Answers   BPO, Microsoft,


How to initialize Dictionary using collection initialize?

1 Answers   Wipro,


What are linked lists used for?

1 Answers  


Is bubble sort faster than selection sort?

1 Answers  


Define articulation point?

1 Answers  


What do you mean by secondary clustering?

1 Answers  


Can we add elements to final list?

1 Answers  


Categories