11import collections
2+ from graphical import drawtree , deserialize
23
34NodesBeenMade = 0
45
@@ -100,8 +101,35 @@ def find(self , atribute) :
100101 for j in i :
101102 if j == atribute :
102103 return x
104+
105+ def MakeList (self , type ) -> list :
106+ MyList = []
107+ result = tree .PrintTree (type )
108+ for i in result :
109+ if i != "," :
110+ MyList .append (int (i ))
111+ return MyList
112+
113+ def compare (self , type ) :
114+ result = tree .MakeList (type )
115+ print (result )
116+ lst = list (map (int , input ('Enter your tree with desired order : ' ).split ()))
117+ return True if result == lst else False
118+
119+ def draw (self ) :
120+ result = tree .PrintTree ('levelorder' )
121+ result_fixed = []
122+ for i in result :
123+ for j in i :
124+ result_fixed .append (j )
125+ drawtree (deserialize (str (result_fixed )))
126+
127+
103128
104129
130+
131+
132+
105133
106134
107135 """_summary_
@@ -124,7 +152,7 @@ def find(self , atribute) :
124152# delete the tree -> 1
125153# MAX and MIN in our tree -> 1
126154# full tree -> 0
127- # compare of two tree -> 0
155+ # compare of two tree -> 1
128156
129157
130158
@@ -137,8 +165,13 @@ def find(self , atribute) :
137165
138166
139167
140- print (tree .PrintTree ("levelorder" ))
141- result = tree .MAX_MIN ()
142- print ("MAX and MIN is equal to : " , result )
143- x = tree .find (5 )
144- print ("Found the desired element at the : [" , x , "] floor " )
168+ # print(tree.PrintTree("preorder"))
169+ # result = tree.MAX_MIN()
170+ # print("MAX and MIN is equal to : " , result)
171+ # x = tree.find(5)
172+ # print("Found the desired element at the : [" , x , "] floor ")
173+ print (tree .draw ())
174+
175+ # lst = list(map(int , input('Enter your tree with ' , type , " order : ").split()))
176+ # print(lst)
177+
0 commit comments