第20921题 单选题
给定节点值互不相同的二叉排序树的搜索函数,判断以下说法一定正确的是哪一项?

在二叉排序树(Binary Search Tree, BST)中,假设节点值互不相同。给定如下搜索函数:

bool find(Node* root, int x) {    
    while (root) {        
        if (root->val == x) return true;        
        root = (x < root->val) ? root->left : root->right;    
    }    
    return false;
}
{{ option.label }}
子题{{ index + 1 }} {{ child.type_label }}
{{ option.label }}
✓ 正确 ◐ 部分正确 ✗ 错误
程序运行统计
暂无判题统计
提交{{ questionInfo.stats ? questionInfo.stats.submit_count : 0 }}次 正确率{{ statsAccuracy }}%
答案解析