这里是LeetCode BFS类型前半部分题目:Binary Tree Zigzag Level Order TraversalBinary Tree Level Order TraversalBinary Tree Level Order Traversal IIClone Graph1.Binary Tree Zigzag Level Order TraversalrefGiven a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and alternate between).For example:
Given binary tree {3,9,20,#,#,15,7},3
/ \
9 20
/ \
15 7return its zigzag level order traversal as:[
[3],
[20,9],
[15,7]
]structZigZag{TreeNode*node;intlevel;ZigZag(TreeNode*p,intn):node(p),le
...
继续阅读
(18)