python数据结构之二叉树的遍历实例

2019-10-06 16:09:22丽君

#       7        8
#     6
#   2   5
# 1    3 4
#
# -------------------------

'''
print '前序(pre-order,NLR)遍历 :n'
bt.preorder(bt.root)

print '中序(in-order,LNR) 遍历 :n'
bt.inorder(bt.root)

print '后序(post-order,LRN)遍历 :n'
bt.postorder(bt.root)

print '层序(level-order,LRN)遍历 :n'
bt.levelorder(bt.root)