mirror of
https://github.com/krahets/hello-algo.git
synced 2025-07-07 15:01:58 +08:00
Modify the exception handling in Java and Python.
This commit is contained in:
@ -52,16 +52,13 @@ if __name__ == "__main__":
|
||||
res = []
|
||||
pre_order(root)
|
||||
print("\n前序遍历的节点打印序列 = ", res)
|
||||
assert res == [1, 2, 4, 5, 3, 6, 7]
|
||||
|
||||
# 中序遍历
|
||||
res.clear()
|
||||
in_order(root)
|
||||
print("\n中序遍历的节点打印序列 = ", res)
|
||||
assert res == [4, 2, 5, 1, 6, 3, 7]
|
||||
|
||||
# 后序遍历
|
||||
res.clear()
|
||||
post_order(root)
|
||||
print("\n后序遍历的节点打印序列 = ", res)
|
||||
assert res == [4, 5, 2, 6, 7, 3, 1]
|
||||
|
Reference in New Issue
Block a user