Amazon Interview Question for Software Engineer / Developers






Comment hidden because of low score. Click to expand.
0
of 0 vote

The binary tree is a BST? If not, that needs to be checked first right? So probably we can combine checking if its a BST and also its depth into a single recursive function. Will that work?

- Anonymous March 31, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

If the check for BST is satisfied, then it all boils down to checking the depth I guess.

- Anonymous March 31, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

using depth means u need to do a dfs and find out the max height and then find the diff...and coming to maxdepth and mindepth it should be sufficient if max depth means the most count of edges...

- sriks April 01, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Checking if binary Tree is AVL or not .... can be done by checking if the Inorder traversal gives a ascending order array.

But i did not understand the difference between depth and height... because I had thought both are same ... or rather depth+1 is height...

- Anonymous April 03, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

In an AVL tree the depth should be logN and the left and right subtrees can differ by at most 1. Thus the condition should be sufficient.

- lala April 10, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

It is comparison between BT and AVL not BST and AVL. so first check for Is it a BST or not. If it is not BST it can't be AVL. then second condition is enough

- pankaj April 14, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

what is the difference between height and depth.. both are same???

- Anonymous June 05, 2011 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More