思路:删除某个节点就将他的子左节点或者子右节点添加进去
static void printTree(Node root) {
if (root == null)
return;
List<Node> nodes = new ArrayList<>();
nodes.add(root);
while (nodes.size() != 0) {
Node remove = nodes.remove(0);
System.out.print(remove.value+ " ");
if (remove.left!=null)
nodes.add(remove.left);
if (remove.right!=null)
nodes.add(remove.right);
}
}