Question

Write recursive C++ methods to search, insert, and delete from a binary search tree.

Hint: The insert and delete methods basically need the search method.

EXPERT ANSWER

The below-mentioned method performs the search, insert, and delete operation from a binary search tree.

struct node

{

int key;

struct node *left, *right;

};

struct node *newNode(int item)

{

struct node *temp = (struct node *)malloc(sizeof(struct node));

temp->key = item;

temp->left = temp->right = NULL;

return temp;

}

struct node* search(struct