refactor: Make code more understandable (#7196)

* refactor: Make code more understandable

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Caeden 2022-10-14 23:25:15 +01:00 committed by GitHub
parent 0c06b25582
commit 2058775005
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -15,7 +15,20 @@ class Node:
def make_tree() -> Node | None:
return Node(1, Node(2, Node(4), Node(5)), Node(3))
r"""
The below tree
1
/ \
2 3
/ \
4 5
"""
tree = Node(1)
tree.left = Node(2)
tree.right = Node(3)
tree.left.left = Node(4)
tree.left.right = Node(5)
return tree
def preorder(root: Node | None) -> list[int]: