Module aoc::year2017::day07

source ·
Expand description

§Recursive Circus

Tree structures are tricky to implement in Rust, requiring wrapping the pointer in a Rc. To avoid this we store the tree “upside down” with each node containing a single index to its parent, stored in a flat vec.

We rely on a special structure of the input that the unbalanced node requiring change will always be the lowest node in the tree and have at least two other balanced siblings so that we can disambiguate.

Structs§

Functions§

Type Aliases§