Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

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.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote