📜  python 深度优先搜索 - Python 代码示例

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

代码示例2
# left to right, pre-order depth first tree search, recursive. O(n) time/space
def depthFirstSearchRec(root):
    if root == None: return
    print(root)
    depthFirstSearch(root.left)
    depthFirstSearch(root.right)