public class TreeNode{
int val;
TreeNode left;
TreeNode right;
TreeNode(int x){
val=x;
}
}
class Solution{
public TreeNode inverTree(TreeNode root){
if(root==null)
return NULL;
Queue<TreeNode>queue =new LinkedList<>();
queue.offer(root);
while (!queue.isEmpty())
{
TreeNode node =queue.poll();
TreeNode rightTree=node.right;
node.right=node.left;
node.left=rightTree;
if (node.left!=NULL)
{
queue.offer(node.left);
}
if (node.right!=NULL)
{
queue.offer(node.right);
}
}
return root;
}
}
这里面还缺少哪些代码?