Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8037

Teaching and learning resources • Re: Advent of Code 2024

$
0
0
Next up for me is the reindeer maze. Day 16 is one of the puzzles missing from the Pico runs

viewtopic.php?p=2281318#p2281318

so I'm thinking of solutions that could run on the Pico after converting the Chapel code to C.

I'm surprised a priority queue implementation of Dijkstra's minimal path algorithm

https://en.m.wikipedia.org/wiki/Dijkstra's_algorithm

takes too much memory. It seems the graph is too big when each character in the maze counts as a vertex or three.
Using my data the priority q reaches a size of 367. Assuming about 100k of heap space would mean a maximum q element size of 270 bytes. Each element has a 16 byte key an a vector of up to 3x16 byte of data.
I think the associative array "dist" may be what's taking too much memory. Fido has reduced the memory use by removing all grid points with only one way in and one way out. Unfortunately the priority queues were also removed and linear searches now replace the associative arrays. It's running a little slow.

Statistics: Posted by ejolson — Sun Jan 26, 2025 7:39 am



Viewing all articles
Browse latest Browse all 8037

Trending Articles