Examveda

What is the code below trying to print?
void print(tree *root,tree *node)
{
  if(root ==null) return 0
  if(root-->left==node || root-->right==node) || print(root->left,node)
  ||printf(root->right,node)
  {
     print(root->data)
  }
}

A. just printing all nodes

B. not a valid logic to do any task

C. printing ancestors of a node passed as argument

D. printing nodes from leaf node to a node passed as argument

Answer: Option C


This Question Belongs to Data Structure >> Binary Search Trees(B Tree)

Join The Discussion

Related Questions on Binary Search Trees(B Tree)