Module aoc::year2021::day09

source ·
Expand description

§Smoke Basin

Part 2 is the classic flood fill algorithm with a twist to return the size of the filled area. This algorithm can be implemented either as a DFS using recursion or as a BFS using an auxilary data structure such as a VecDeque.

This solution uses a DFS approach as it’s faster and Rust’s stack size limit seems enough to accommodate the maximum basin size. 2 dimensional grids are common in Advent of Code problems so we use our utility Grid and Point modules.

Functions§