MCPcopy Create free account
hub / github.com/Jack-Lee-Hiter/AlgorithmsByPython / preorder

Method preorder

BinaryTree.py:37–42  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

35 # 树的前序遍历
36 # 树的后序遍历以及中序遍历见ParseTree.py
37 def preorder(self):
38 print(self.key)
39 if self.leftChild:
40 self.leftChild.preorder()
41 if self.rightChild:
42 self.rightChild.preorder()
43
44'''
45以下为测试数据, 去掉 # 即可

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected