Graph Theory37 sections · 1633 units
Open in Course

Quiz: DFS State Tracking

Knowledge check

Check Your Understanding

You run DFS on a tree where each node stores a value. You want to count how many root-to-leaf paths have a sum greater than 100100. Where in the DFS code should you check if the path sum exceeds 100100?

  1. A.Only at leaf nodes (nodes with no unvisited children)
  2. B.At every node during the traversal
  3. C.Only at the root before starting DFS
  4. D.After DFS finishes, using the returned values
Start the roadmap to answer the quizzes and solve the challenges