Computer Science, asked by anjalilohani36, 10 months ago

Write an algorithm and program that creates a Binary Search Tree with a set of given
inputs. Then, it should prompt for a key value and print a message about the presence of
key value in the Binary Search Tree.

Answers

Answered by sibychacko2
0

Answer:

the company has been

Explanation:

the company has been in the business of enanoda since the beginning and dan in a new relationship to the new York giants for three months now to pay the price 8miles the Washington

Answered by lovingheart
1

struct node* search(struct node* root, int key)  

{  

   // Base Cases: root is null or key is present at root  

   if (root == NULL || root->key == key)  

      return root;  

     

   // Key is greater than root's key  

   if (root->key < key)  

      return search(root->right, key);  

 

   // Key is smaller than root's key  

   return search(root->left, key);  

}  

int main()

{

//declaration and insertion of values to the BST

int key = 0;

cout<<”Enter the key value for search:”;

cin>>key;

search(root, key); //invoke search method

}

Here it is considered that all the insertion has been done to the structure variable and now the search operation is about to happen. So the key value will be ob

Similar questions