pleroma.debian.social

Advent of Code 2022 day 7
I chose to use a tree data structure. I spent yesterday writing my own tree implementation and fighting with the borrow checker in #rust. Then, before going to bed, I looked online to see how others wrote the tree data structure in rust and I found a post that explained how trees are pain in rust. Of course, I see someone else's solution for AOC day 7 in the comments of the post which used a reverse lookup hash table - a much better solution.
replies
1
announces
0
likes
0

re: Advent of Code 2022 day 7
Anyways, here is the blog post. It's a good read:
https://dev.to/deciduously/no-more-tears-no-more-knots-arena-allocated-trees-in-rust-44k6

I also posted my solution using rust's indextree library for trees:

https://git.sr.ht/~anjan/advent2022/tree/main/item/day7

I dont think I needed to traverse through the tree 3 times - I probably could of done it in 1-2 traversal(s). I probably shouldve used a reverse lookup hash table but I didnt want to use a spoiler =P