Re:Speeding up my Advent of Code solution with Dijkstra's Al...
by yxhuvud on Saturday January 01, 2022 @08:16AM
(#29758026)
Yes, though sometimes it is possible to replace a fully general priority queue with a faster structure that is using the structure of the problem at hand. For example, this problem (AoC day 15) has only ever a count of unique priorities that is 11 or fewer. That allows a queue implementation to be https://github.com/yxhuvud/aoc21/blob/main/day15.cr#L27-L51 , being amortized O(1) in both insertion and deletion. This pushed down the runtime another magnitude for me, the whole day running at 0.014s.
[ Parent
| on HN ]
There are no comments on this comment yet.