Python实现二叉树(4种遍历,含层序遍历)
code
class TreeNode(object):
def __init__(self, data=None, left=None, right=None):
self.data = data
self.left = left
self.right = right
class BinaryTree(object):
def __init__(self, data_list):
self.it = iter(data_list)
self.root = TreeNode()
self.create_tree()
def inorder_create(self, bt=None)