Hey ppl, this question was asked in amazon technical round. The aspirants were given a binary tree and they had to check whether this tree is a binary search tree or not. Can anyone suggest an algorithm???
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a
member of our community. Consider creating an
account or login.
Binary Search Trees have a constraint of left node and sub nodes of the main node to be smaller and the right node and sub nodes to be larger than the main node. Using that constraint you can manually verify it. 😀 Do you need a program or something for it? 😐
@biroramani: thanks for the link....😀
@praveen: nah i got it.....actually i was confused about taking the range for the starting element and i did a mistake in recursion.....now its working completely fine....thanks anyway.....😀