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 |
what is the different between B-tree and B+ tree.
Can map contain duplicate keys?
How does bogo sort work?
What should be done in the base case for this recursive problem?
Which is the parent class of sortedset<e> class?
Parenthesis are never needed in prefix or postfix expressions. Why?
How to initialize Dictionary using collection initialize?
What are linked lists used for?
Is bubble sort faster than selection sort?
Define articulation point?
What do you mean by secondary clustering?
Can we add elements to final list?