Amazon interview question

write a function to check if a binary tree is a binary search tree.

Interview Answer

Anonymous

May 9, 2012

Here is the functionality that needs to be implemented. 1. Do an inorder traversal. 2. Check if the elements that are visited are in non-decreasing order. 3. If all the elements are in non-decreasing order, then it is a BST. 4. Else not a BST.

1