public class TreeNode(){
public int val;
publicTreeNode Left;
public TreeNode Right;
public TreeNode(int x){
val=x
}
局部变量temp获取当前结点,queue获取此结点下的左右结点。循环遍历直到queue为空