📅  最后修改于: 2022-03-11 15:04:34.280000             🧑  作者: Mango
//Binary Search Tree (BST): Function to search a value
bool BST_SearchTree(int Key){
int ValueInTree = false;
TreeNode *temp;
temp = root;
while((temp != NULL) && (temp->Key != Key))
{
if(Key < temp->Key)
temp = temp->left;
else
temp = temp->right;
}
if(temp == NULL)
cout<< "NOT FOUND";
else
cout<< "FOUND";
}