📜  命令行 coursera - C 编程语言代码示例

📅  最后修改于: 2022-03-11 15:04:34.280000             🧑  作者: Mango

代码示例1
//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";
}