You need to change the condition on line 5.
Right now it checks that both left and right are not NULL.
You need a condition where left or right is not NULL, but not both, and not neither.
That is, only one of left and right may be non-NULL.
Hint, the condition will be fairly long. It will look something like
|
if ( (a && b) || (c && d) )
|
where a, b, c, and d are something like
t->left != NULL
or
t->left == NULL
.
In English, the “knot” is called a
node.
A node may have zero or more
branches.
A node with zero branches is called a
leaf.
Hope this helps.