📜  在 python 代码示例中遍历树

📅  最后修改于: 2022-03-11 14:46:04.603000             🧑  作者: Mango

代码示例1
"""Post-order"""
    def postorder_traversal(self, root):
        res = []

        if root:
            res = self.predorder_traversal(root.left)
            res = res + self.predorder_traversal(root.right)
            res.append(root.data)
        return res