fix: Use .equals() to compare two strings in Java (#961)
This commit is contained in:
parent
9b35f75505
commit
5b6fb34a82
@ -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…
x
Reference in New Issue
Block a user