第23744题 单选题
阅读以下C++实现的二叉树深度优先搜索迭代版代码,横线上应填写的正确代码是?
void dfs(TreeNode* root) {
    if (root == nullptr)
        return;

    stack<TreeNode*> s;
    s.push(root);
    while (!s.empty()) {
        ________________________ // 在此处填入代码
        cout << node->value << " ";

        if (node->right) s.push(node->right);
        if (node->left) s.push(node->left);
    }
}
{{ option.label }}
子题{{ index + 1 }} {{ child.type_label }}
{{ option.label }}
✓ 正确 ◐ 部分正确 ✗ 错误
程序运行统计
暂无判题统计
提交{{ questionInfo.stats ? questionInfo.stats.submit_count : 0 }}次 正确率{{ statsAccuracy }}%
答案解析