Skip to content

Commit 1ce58ef

Browse files
authored
With example
1 parent 0e02818 commit 1ce58ef

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

data_structures/Binary Tree/binary_seach_tree.py

+24
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,27 @@ def preShow(self, curr_node):
7575
def getRoot(self):
7676
return self.root
7777

78+
79+
'''
80+
Example
81+
8
82+
/ \
83+
3 10
84+
/ \ \
85+
1 6 14
86+
/ \ /
87+
4 7 13
88+
'''
89+
90+
t = BinarySearchTree()
91+
t.insert(8)
92+
t.insert(3)
93+
t.insert(1)
94+
t.insert(6)
95+
t.insert(4)
96+
t.insert(7)
97+
t.insert(10)
98+
t.insert(14)
99+
t.insert(13)
100+
101+
t.preShow(t.getRoot())

0 commit comments

Comments
 (0)