A detective is searching for clues in a mansion and uses depth-first search(DFS) to investigate every room, he always moves to the next available door in alphabetical order.

The mansion layout is: the Entrance has doors to the Ballroom and the Library. The Ballroom leads to the kitchen. The Kitchen leads to the Study and the Dining Room. The Library leads to the Observatory. The Dining Room, Study and Observatory don't lead to any relevant rooms.

Which sequence correctly describes the detective's DFS walkthrough?

a) Entrance → Ballroom → Kitchen → Dining Room → Study → Library → Observatory

b) Entrance → Ballroom → Library → Kitchen → Dining Room → Study → Observatory

c) Entrance → Ballroom → Kitchen → Dining Room → Library → Observatory → Study

d) Entrance → Library → Observatory → Ballroom → Kitchen → Dining Room → Study

e) None of the above.

Comments

  1. Nice question, but we already have many similar questions in the bog.

    ReplyDelete

Post a Comment

Popular posts from this blog