mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-01-18 16:27:02 +00:00
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:
parent
0c06b25582
commit
2058775005
|
@ -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]:
|
||||
|
|
Loading…
Reference in New Issue
Block a user