logo

Crowdly

Browser

Add to Chrome

The following numbers are inserted in a BST: 25, 17, 32, 35, 28.  What number ...

✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.

The following numbers are inserted in a BST: 25, 17, 32, 35, 28. 

What number is stored in the right child of root after executing Z with input arguments: the root of the BST and number 32?

function Z(root, x) 

   if (root==NULL) 

     return NULL 

   else 

         if(x < root->data) 

            root->left=Z(root->left,x) 

         else 

             if (x > root->data) 

                 root->right=Z(root->right,x) 

             else 

                 if (root->left!= NULL and root->right!=NULL) 

                     Node tmp=getRMin(root->right) 

                     root->data=tmp->data 

                     root->right=Z(root->right, root->data) 

                else 

                     if (root->left== NULL and root->right==NULL) 

                         root=NULL 

                          return root               

end function  

More questions like this

Want instant access to all verified answers on learn.gold.ac.uk?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!

Browser

Add to Chrome