delete minimum in BST problem
Code:
struct node
{ int data;
struct node* left;
struct node* right;
};
in main i create struct node* root, and insert other nodes, after this I apply this function to root:
Code:
void deleteMin(struct node* t){
struct node* temp;
if(t!=NULL){
if(t->left!=NULL)
deleteMin(t->left);
else{ temp=t;
t=t->right;
free(temp);
}
}
}
The program crashes when I try to display the BST again. I guess the deleteMin function somehow deletes the entire BST.PLease help and thank you in advance