第41757题 单选题
下面代码实现二叉树深度优先搜索(迭代版前序遍历),横线处应当填写( )。
class TreeNode:
    def __init__(self, val):
        self.value = val
        self.left = None
        self.right = None

def dfs(root):
    if root is None:
        return
    s = []
    s.append(root)
    while len(s) > 0:
        node = s.pop()
        print(node.value, end=" ")
        # --------此处填空--------
{{ option.label }}
子题{{ index + 1 }} {{ child.type_label }}
{{ option.label }}
✓ 正确 ◐ 部分正确 ✗ 错误
程序运行统计
暂无判题统计
知识点:
提交{{ questionInfo.stats ? questionInfo.stats.submit_count : 0 }}次 正确率{{ statsAccuracy }}%
答案解析