MCPcopy
hub / github.com/Jack-Lee-Hiter/AlgorithmsByPython / inOrder

Method inOrder

Target Offer/递归和非递归实现二叉搜索树的三种遍历.py:33–44  ·  view source on GitHub ↗
(self, root)

Source from the content-addressed store, hash-verified

31 self.preOrderRec(root.right)
32 # inorder without recursion
33 def inOrder(self, root):
34 if root == None:
35 return
36 pNode, treeStack = root, []
37 while pNode or len(treeStack) > 0:
38 while pNode:
39 treeStack.append(pNode)
40 pNode = pNode.left
41 if len(treeStack) > 0:
42 pNode = treeStack.pop()
43 print(pNode.val)
44 pNode = pNode.right
45 # inorder with recursion
46 def inOrderRec(self, root):
47 if root != None:

Callers

nothing calls this directly

Calls 1

popMethod · 0.45

Tested by

no test coverage detected