Skip to content

Commit 2058775

Browse files
refactor: Make code more understandable (TheAlgorithms#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>
1 parent 0c06b25 commit 2058775

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

data_structures/binary_tree/binary_tree_traversals.py

+14-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,20 @@ class Node:
1515

1616

1717
def make_tree() -> Node | None:
18-
return Node(1, Node(2, Node(4), Node(5)), Node(3))
18+
r"""
19+
The below tree
20+
1
21+
/ \
22+
2 3
23+
/ \
24+
4 5
25+
"""
26+
tree = Node(1)
27+
tree.left = Node(2)
28+
tree.right = Node(3)
29+
tree.left.left = Node(4)
30+
tree.left.right = Node(5)
31+
return tree
1932

2033

2134
def preorder(root: Node | None) -> list[int]:

0 commit comments

Comments
 (0)