您的位置:首页 > 其它

BST二叉搜索树的查找算法

2016-05-26 08:57 239 查看
BST二叉搜索树的查找算法

bool SearchBST(TreeNode *pRoot,int key)
{
bool result = false;
if(pRoot==NULL)
return result;
if(key == pRoot->val)
result = true;
else if(key<pRoot->val)
result = SearchBST(pRoot->left,key);
else
result = SearchBST(pRoot->right,key);
return result;
}

将继续学习BST的插入、删除操作
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  二叉树 BST