J
jw
i have a b.tree that has a prefix expression like this->+ x 2 - 5 1 x 3
2
if i use this recursive function it prints ((2x(5-1))+(3x2))
void printTree(t)
if(t.left!=NULL)
print("(");
printTree(t.left);
print(t.element);
if(t.right!=NULL)
printTree(t.right);
print(")");
can you explain why it prints ((2x(5-1))+(3x2))
2
if i use this recursive function it prints ((2x(5-1))+(3x2))
void printTree(t)
if(t.left!=NULL)
print("(");
printTree(t.left);
print(t.element);
if(t.right!=NULL)
printTree(t.right);
print(")");
can you explain why it prints ((2x(5-1))+(3x2))