✏️ Explanatory Question

How to check if a given Binary Tree is BST or not?

👁 888 Views
📘 Detailed Answer
No previous question
💡

Answer with Explanation

If inorder traversal of a binary tree is sorted, then the binary tree is BST. The idea is to simply do inorder traversal and while traversing keep track of previous key value. If current key value is greater, then continue, else return false.

No previous question