Examine the following Print function and determine which traversal it is. void P
ID: 3901412 • Letter: E
Question
Examine the following Print function and determine which traversal it is.
void Print(TreeNode<ItemType>* tree);
{
if (tree != NULL)
{
Print(tree->right);
tree->info.PrintItem();
Print(tree->left);
}
}
A) Inorder
B) Preorder
C) Postorder
D) By level
Explanation / Answer
Answer: Option A - Inorder
This is also known as reverse inorder as the elements are printed in decreasing order with a BST.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.