Frage im Vorstellungsgespräch bei Amazon

Check given binary tree is BST or not

Antworten zu Vorstellungsgespräch

Anonym

5. Juli 2011

The left subtree of a node contains only nodes with keys less than the node's key. The right subtree of a node contains only nodes with keys greater than the node's key. Both the left and right subtrees must also be binary search trees.

1

Anonym

18. Sept. 2011

Just do Inorder traversal and make sure that the numbers are printed in increasing order assuming that the key is integer! Looking back, inorder traversal prints BST in ascending order.

1