What is the preorder traversal of the binary tree described below? A is the…

2025

What is the preorder traversal of the binary tree described below?

  • A is the root.

  • B and C are the left and right children of A, respectively.

  • D and E are the left and right children of B, respectively.

Answer: B. ABDECConceptPreorder traversal processes each node before its subtrees. Its fixed order is root, then the complete left subtree, then the complete right subtree.…

  1. A.

    DEBCA

  2. B.

    ABDEC

  3. C.

    DBEAC

  4. D.

    ADBEC

Attempted by 337 students.

Show answer & explanation

Correct answer: B

Concept

Preorder traversal processes each node before its subtrees. Its fixed order is root, then the complete left subtree, then the complete right subtree.

Application

  1. Start at root A, so A is visited first.

  2. Enter A’s left subtree at B and visit B before B’s children.

  3. Traverse B’s left child D, followed by B’s right child E.

  4. After completing the left subtree, traverse A’s right child C.

Cross-check

  • A occurs before both B and C, as required for the root.

  • Within B’s subtree, B occurs before D and E.

  • The entire B subtree is completed before C.

Therefore, the preorder traversal is ABDEC.

Explore the full course: Rssb Basic Computer Instructor

Loading lesson…