Amazon Interview Question for Software Engineer / Developers






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

traverse(s)
{
if(s) {
preorder_queue.add(s);
traverse(s->left);
inorder_queue.add(s);
traverse(s->right);
postorder_queue(s);
}
}

- Cougar_CS October 14, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Really really awesome algorithm. From where did u get this idea.

- Anonymous August 16, 2009 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

Respect !

- abhimanipal April 14, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

Realy awesome alog..

- RD February 23, 2011 | Flag
Comment hidden because of low score. Click to expand.
1
of 1 vote

nothing so special about the solution!!!!go through the recursive versions of each traversal and simply merge all the solutions

- prabal June 23, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

Really awesome algorithm dude. Thanks for sharing :).
I spent some time: printing out one iteration and seeing how it can be manipulated to get the other two but this is thinking smart not hard.

- JSDUDE May 23, 2013 | Flag
Comment hidden because of low score. Click to expand.
1
of 1 vote

Really awesome algo .....Hats off to Cougar .......

- sai October 15, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

awesome algo

- R... October 15, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

private void traverse(Node h)
{
if (h == null) return;
h.item.visit();
traverse(h.l);
traverse(h.r);
}
void trav()
{ traverse(root); }

By default the code implements a preorder traversal; if we put the method h.item.visit() between the recursive calls, we have an inorder traversal; and if we put it after the recursive calls, we have a postorder traversal.

- BST October 16, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

first algo brilliant algo

- sourabh September 02, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

@Cougar_CS
You rock buddy! Awesome algorithm. Thanks a lot.

- klpd September 08, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

@Cougar Reallyyyy awesome...

- pavan September 11, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Salute to the hero Cougar_CS !!!!!!!!!!!!!!!!!!!!!!!!!

- Helper December 15, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

sexy soln mahn....!!

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

Really Man , How did u think about this algo .. Bow to Cougar_CS

- broadcaster July 10, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

ssalute>>

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

are you guys serious,a fifth grader can think of such a naive solution.

- wpgShashank June 11, 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