Question: In a binary tree, print the nodes in zigzag order. In the first level, nodes are printed in the left to right order. In the
In a binary tree, print the nodes in zigzag order. In the first level, nodes are printed in the left to right order. In the second level, nodes are printed in right to left and in the third level again in the order left to right. Use two stacks. Pop from first stack and push into another stack.
Swap the stacks alternatively.
Step by Step Solution
3.47 Rating (157 Votes )
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
