###### LeetCode107 Binary Tree Level Order Traversal II

Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root).

For example:
Given binary tree {3,9,20,#,#,15,7},

    3
/ \
9  20
/  \
15   7


return its bottom-up level order traversal as:

[
[15,7],
[9,20],
[3]
]

 public static List<List<Integer>> levelOrderBottom(TreeNode root) {

List<List<Integer>> result=new ArrayList<List<Integer>>();//返回的最终结果

//处理第一个节点（root）
if(root==null)
return result;
else {
List<Integer> temp=new ArrayList<>();//存放暂时的结果
treeNodes2.offer(root);

}

while(!treeNodes2.isEmpty())
{
int i=treeNodes2.size();
List<Integer> tempReslut=new ArrayList<>();//存放暂时的结果
while(i>0)//遍历这一层的所有节点
{

TreeNode tNode=treeNodes2.poll();
if(tNode.left!=null)
{
treeNodes2.offer(tNode.left);
}
if(tNode.right!=null)
{
treeNodes2.offer(tNode.right);
}
i--;
}

}

return result;

}

#### 【LeetCode】107. Binary Tree Level Order Traversal II 解题报告

2016-05-26 16:18:51

#### LeetCode 107:Binary Tree Level Order Traversal II

2015-05-31 00:11:23

#### LeetCode --- 107. Binary Tree Level Order Traversal II

2015-04-17 16:46:33

#### leetcode 107 Binary Tree Level Order Traversal II C++

2016-05-28 20:57:50

#### leetcode 之Binary Tree Level Order Traversal I和II 解题思路

2014-07-11 23:43:09

#### leetCode解题报告之Binary Tree Level Order Traversal II,I(二叉树层次遍历)

2014-03-28 20:28:01

#### 102. Binary Tree Level Order Traversal [easy] (Python)

2016-05-10 14:40:58

#### [leetcode-107]Binary Tree Level Order Traversal II(java)

2015-08-11 12:56:34

#### LeetCode102 Binary Tree Level Order Traversal Java

2016-04-23 14:20:55

#### [LeetCode 107]Binary Tree Level Order Traversal II(递归法）

2016-07-24 17:39:08

## 不良信息举报

LeetCode107 Binary Tree Level Order Traversal II