Implement zigzag level order traversal for a tree.