Which of the following best describes the correct sequence of node visits in a…

2025

Which of the following best describes the correct sequence of node visits in a preorder traversal of a tree?

  1. A.

    Visit root → Visit left subtree → Visit right subtree

  2. B.

    Visit left subtree → Visit right subtree → Visit root

  3. C.

    Visit right subtree → Visit root → Visit left subtree

  4. D.

    Visit left subtree → Visit root → Visit right subtree

Attempted by 112 students.

Show answer & explanation

Correct answer: A

Preorder traversal visits nodes in the order: root first, then recursively traverse the left subtree, and finally traverse the right subtree. This sequence ensures that each node is processed before its children.

Explore the full course: Niacl Ao It Specialist