3.6 of 5 7,025 reviews Redmond, WA 5000+ Employees

Microsoft Software Development Engineer Intern Interview Question (student candidate)

I interviewed in Redmond, WA and was asked:
"Print a binary tree level by level in zigzag order"
Add Tags [?]
Answer Flag Question

Part of a Software Development Engineer Intern Interview Review - one of 3,166 Microsoft Interview Reviews

Answers & Comments

of 1
You should use two stacks: for the current level and for the next one.
- Alexey on Jan 07, 2013 Flag Response
of 3
Use a queue.
1.Push root on queue.
2. Begin Loop Repeat while node is not equal to NULL:
            a. Pop
            b. Print value
            c. Push node's Right Child
            d. Push node's Left Child
3. End
- Nofel on Jan 27, 2013 Flag Response
of 1
The answer given by me above is wrong because I was not clear about the zig zag ordering I applied it wrong !
- Nofel on Jan 27, 2013 Flag Response

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

Microsoft – Why Work for Us?

What do you want in a job? Do you want more than a paycheck? At Microsoft, you can discover potential you didn’t know you had, push your limits, turn your ideas into reality and make a real impact on the industry and… Full Overview

Provided by employer [?]

Tags are like keywords, helping to categorise interview questions that have something in common.

Glassdoor is your free inside look at Microsoft interview questions and advice. All interview reviews are posted anonymously by Microsoft employees and interview candidates.