Graph Theory37 sections · 1633 units
Open in CourseQuiz: 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 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?
- A.The area count is off by per island
- B.Only the first island's area is wrong
- C.The algorithm gives correct results but runs slower
- D.The algorithm enters an infinite loop or stack overflow