I need some help with the following problem. We've touched on scanning tree algorithms a little bit, but not to this extent. My textbook has been useless so far. Can somebody help me with the answers to this?
Answer the following:
template <typename T>
int treeFunc(tnode<T> *t)
{ int n = 0, left, right;
if (t != NULL)
{ if (t->left != NULL)
n++;
if (t->right != NULL)
n++;
left = treeFunc(t->left);
right = treeFunc(t->right);
return n + left + right;
}
else
return 0;
}
What tree scanning algorithm is used above?
(i) preorder left
(ii) inorder left
(iii) postorder left
(iv) inorder right
Any other scanning algorithm could be used to implement the above code?
(v) True
(vi) False