Skip to content
This repository was archived by the owner on Feb 3, 2025. It is now read-only.

Commit 2db676e

Browse files
committed
XD
1 parent 8bbc62b commit 2db676e

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

Node.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ def find(self , atribute) :
101101
for j in i :
102102
if j == atribute :
103103
return x
104+
return "Not Found ! "
104105

105106
def MakeList(self , type ) -> list :
106107
MyList = []
@@ -122,15 +123,11 @@ def draw(self) :
122123
for i in result :
123124
for j in i :
124125
result_fixed.append(j)
125-
drawtree(deserialize(str(result_fixed)))
126-
127-
128-
129-
130-
131-
132-
126+
drawtree(deserialize(str(result_fixed)))
133127

128+
def countLeaves(self) :
129+
result = tree.PrintTree("levelorder")
130+
return len(result[2])
134131

135132
"""_summary_
136133
2
@@ -147,7 +144,7 @@ def draw(self) :
147144
# insert method -> 1
148145
# NodesBeenMade for number of nodes -> 1
149146
# number of floors -> 1
150-
# how to define number of leaves -> 0
147+
# how to define number of leaves -> 1
151148
# made the 4 method and its working -> 1
152149
# delete the tree -> 1
153150
# MAX and MIN in our tree -> 1
@@ -170,7 +167,15 @@ def draw(self) :
170167
# print("MAX and MIN is equal to : " , result)
171168
# x = tree.find(5)
172169
# print("Found the desired element at the : [" , x , "] floor ")
170+
print(tree.PrintTree('preorder'))
171+
print(tree.PrintTree('inorder'))
172+
print(tree.PrintTree('postorder'))
173+
print(tree.PrintTree('levelorder'))
174+
print(tree.floors_number())
175+
print(tree.MAX_MIN())
176+
print(tree.find(7))
173177
print(tree.draw())
178+
print(tree.countLeaves())
174179

175180
# lst = list(map(int , input('Enter your tree with ' , type , " order : ").split()))
176181
# print(lst)

0 commit comments

Comments
 (0)