-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDFS.py
More file actions
32 lines (24 loc) · 655 Bytes
/
DFS.py
File metadata and controls
32 lines (24 loc) · 655 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from BinaryTree import BinaryTree
a_node=BinaryTree(1)
a_node.insert_left(2)
a_node.insert_right(5)
two_node=a_node.left_child
two_node.insert_left(3)
two_node.insert_right(4)
five_node=a_node.right_child
five_node.insert_left(6)
five_node.insert_right(7)
three_node=two_node.left_child
three_node.insert_left(20)
a_node.pre_order()
print("In Order ******")
a_node.in_order()
print("Post Order ******")
a_node.post_order()
# print(a_node.value)
# print(two_node.value)
# print(a_node.right_child.value)
# print(two_node.left_child.value)
# print(two_node.right_child.value)
# print(five_node.left_child.value)
# print(five_node.right_child.value)