MCPcopy Index your code
hub / github.com/Jack-Lee-Hiter/AlgorithmsByPython / inorder

Function inorder

ParseTree.py:71–75  ·  view source on GitHub ↗
(tree)

Source from the content-addressed store, hash-verified

69
70# 递归实现中序遍历
71def inorder(tree):
72 if tree != None:
73 inorder(tree.getLeftChild())
74 print(tree.getRootVal())
75 inorder(tree.getRightChild())
76
77# 因为中序遍历会丢失括号信息, 因此尝试构造一个函数回复解析表达式
78def printexp(tree):

Callers

nothing calls this directly

Calls 3

getLeftChildMethod · 0.80
getRootValMethod · 0.80
getRightChildMethod · 0.80

Tested by

no test coverage detected