Question

Given a binary tree, a "zigzag" level order traversal prints the nodes level by level, but alternating the order of nodes from left-to-right and right-to-left for successive levels.     For example, Level 0 (root) is L-R, Level 1 is R-L, Level 2 is L-R, and so on.     Consider the following binary tree:     ```           3          / \         9  20           /  \          15   7     ```     What is the output of a zigzag level order traversal for this tree? 

A `3, 9, 20, 15, 7`
B `3, 20, 9, 15, 7`
C `3, 20, 9, 7, 15`
D `3, 9, 20, 7, 15`
Practice Next

Hey! Ask a query