mirror of
https://github.com/krahets/hello-algo.git
synced 2024-12-26 01:16:28 +08:00
fix: Use .equals() to compare two strings in Java (#961)
This commit is contained in:
parent
9b35f75505
commit
5b6fb34a82
1 changed files with 3 additions and 3 deletions
|
@ -63,15 +63,15 @@ class ArrayBinaryTree {
|
||||||
if (val(i) == null)
|
if (val(i) == null)
|
||||||
return;
|
return;
|
||||||
// 前序遍历
|
// 前序遍历
|
||||||
if (order == "pre")
|
if ("pre".equals(order))
|
||||||
res.add(val(i));
|
res.add(val(i));
|
||||||
dfs(left(i), order, res);
|
dfs(left(i), order, res);
|
||||||
// 中序遍历
|
// 中序遍历
|
||||||
if (order == "in")
|
if ("in".equals(order))
|
||||||
res.add(val(i));
|
res.add(val(i));
|
||||||
dfs(right(i), order, res);
|
dfs(right(i), order, res);
|
||||||
// 后序遍历
|
// 后序遍历
|
||||||
if (order == "post")
|
if ("post".equals(order))
|
||||||
res.add(val(i));
|
res.add(val(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue