auto commit

This commit is contained in:
CyC2018
2018-08-09 23:10:49 +08:00
parent 5b66cbcf30
commit da479e25c6
3 changed files with 4 additions and 89 deletions

View File

@ -1296,10 +1296,7 @@ private boolean isSubtreeWithRoot(TreeNode root1, TreeNode root2) {
## 解题思路
### 递归
<<<<<<< HEAD
=======
>>>>>>> 0d7909db6d01bdfa0a0fd9abaee469b9ddd2e3a4
```java
public void Mirror(TreeNode root) {
if (root == null)
@ -1317,7 +1314,6 @@ private void swap(TreeNode root) {
```
### 迭代
<<<<<<< HEAD
```java
public void Mirror(TreeNode root) {
@ -1338,27 +1334,6 @@ private void swap(TreeNode node) {
node.left = node.right;
node.right = t;
}
=======
```java
public void Mirror(TreeNode root) {
if (root == null)
return;
Stack<TreeNode> stack = new Stack<>();
stack.push(root);
while (!stack.isEmpty()) {
TreeNode p = stack.pop();
if (p.left == null && p.right == null)
continue;
TreeNode left = p.left;
p.left = p.right;
p.right = left;
if (p.left != null)
stack.push(p.left);
if (p.right != null)
stack.push(p.right);
}
}
>>>>>>> 0d7909db6d01bdfa0a0fd9abaee469b9ddd2e3a4
```
# 28 对称的二叉树