F BST Del

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

node deleteinbst(node root,int d)

root

 True 

d<root->data

 False   True 

root->data==d

 False   True  root->left=deleteinbst(root->left,d)  False 

root->left==NULL&&root->right==NULL

root->right=deleteinbst(root->right,d)  False   True 

root->left==NULL&&root->right!=NULL delete root

 True   False 

root->left!=NULL&&root->right==NULL NULL

node temp=root->right  True   False 

node temp=root->left node rep=root->right

 
delete root

temp rep->left!=NULL

 True   False 

rep=rep->left root->data=rep->data

root->right=deleteinbst(root->right,rep->data)

root

You might also like