Graph Theory37 sections · 1633 units
Open in Course

Quiz: Flood Fill Boundaries

Knowledge check

Check Your Understanding

You modify the flood fill algorithm to count the area of each island. You use DFS and return 1+1 + the sum of recursive calls. If you forget to mark cells as visited before recursing (you mark them after the recursive calls return), what happens?

  1. A.The area count is off by 11 per island
  2. B.Only the first island's area is wrong
  3. C.The algorithm gives correct results but runs slower
  4. D.The algorithm enters an infinite loop or stack overflow
Start the roadmap to answer the quizzes and solve the challenges