logo

Crowdly

Browser

Add to Chrome

The following numbers are inserted in a BST: 8, 10, 5, 9 What is printed ...

✅ 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: 8, 10, 5, 9

What is printed on screen after executing function K? 

   

function

 K(root) 

if

(root==NULL)

      return

else 

      K(root->left)  

      k(root->right)  

      

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

             print("C3:", root->data) 

      

else 

             if

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

                  print("C1:", root->data) 

             

else

 

                 

if

(root->left== NULL)

                     tmp=root->data

root->data=root->right->data

                    root->right->data=tmp

             

  else

 

                      tmp=root->data

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

                  root->left->data=tmp

end function
0%
0%
0%
0%
0%
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