MCPcopy Create free account
hub / github.com/geekcomputers/Python / preorder_itr

Function preorder_itr

binary_search_tree.py:209–221  ·  view source on GitHub ↗
(node)

Source from the content-addressed store, hash-verified

207
208
209def preorder_itr(node):
210 # N L R : Node, Left , Right
211 stack = [node]
212 values = []
213 while stack != []:
214 temp = stack.pop()
215 print(temp.info)
216 values.append(temp.info)
217 if temp.right:
218 stack.append(temp.right)
219 if temp.left:
220 stack.append(temp.left)
221 return values
222
223
224def inorder_itr(node):

Callers

nothing calls this directly

Calls 2

popMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected