Amazon.com

  www.amazon.com
Work in HR? Unlock Free Profile

Amazon.com Software Development Engineer Intern Interview Question

"Write a function to determine if a tree is a BST."
Add Tags [?]
Answer

Part of a Software Development Engineer Intern Interview Review - one of 4,635 Amazon.com Interview Reviews

Answers & Comments

0
of 0
votes
Use in-order traversal or track the minimum and maximum for each node and recurse for the entire tree. Return false if the condition is broken; true if it holds for the given tree. (Be careful: the minimum/maximum condition should hold across all levels!)
- Interview Candidate on Sep 15, 2013

To comment on this question, Sign In with Facebook or Sign Up

Tags are like keywords that help categorize interview questions that have something in common.