Amazon Interview Question for Software Engineer / Developers


Country: India
Interview Type: Written Test




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

Breadth first

- Anonymous January 06, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
1
of 1 vote

Breadth first or Level order traversal

- mag January 07, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

BFS, a general approach to traverse tree without recursion

- abhityagi85 January 06, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

agreed, breadth first.

- guest January 06, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Agree, breath first

- magiccs January 06, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 2 vote

I actually think the algorithm described sounds more like pre-order. There is no indication that *all* nodes on the same level are traversed before nodes on the next level.

- eugene.yarovoi January 09, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

-1
after a node is processed, its children are added

think of 1,2,3,4,5,6,7
after 1, .. 2,3 are added.. when 2 is read.. 4,5 are added.. now queue has 3,4,5
now.. when three is processed, 6,7 are added... queue will now have 4,5,6,7 .. all children at same level..
hence breadth first

- mrb January 12, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

You're right. I didn't read carefully enough. I assumed that a node being added to the queue then caused that node to immediately be processed.

- eugene.yarovoi January 12, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

-1 on myself.

- eugene.yarovoi January 12, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Pre-order

- Anonymous January 31, 2022 | 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