In a binary tree, print the nodes in zigzag order. In the first level, nodes are printed

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 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.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Question Posted: