Depth ion travels of the following directed graph is:

2007

Depth ion travels of the following directed graph is:

image.png

  1. A.

    A B C D E F

  2. B.

    A B D E F C

  3. C.

    A C E B D F

  4. D.

    None of the above

Attempted by 189 students.

Show answer & explanation

Correct answer: B

To determine the Depth First Search (DFS) traversal of the graph, we start at the root node A and explore each branch as deeply as possible before backtracking.

1. Start at node **A**. 2. Visit the first neighbor, **B**. From B, visit its first neighbor **D** (a leaf node). Since D has no children, backtrack to B. 3. From B, visit the next neighbor **E**. From E, visit its neighbor **F** (a leaf node). Backtrack to E, then B, and finally A. 4. From A, visit the remaining unvisited neighbor **C**.

The resulting traversal sequence is: A, B, D, E, F, C.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Coding For Placement