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)
}
}
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
Join The Discussion