I am trying to implement dijkstra’s algorithm for path finding and need some sort of priority queue to store the information.
In the past, for example a fifo or filo PQ i’ve simply used an array and then two pointers to the current insert and the current “look” position and then to “remove” and item shifted the look position up once.
However for dijkstra’s I need a PQ that is ordered by weight (or current distance) and then look at the one that is at the top of the PQ, how would I go about implementing this in C?
Thanks for your time!
Edit: People have mentioned binary heap, do you mind giving a slight hint as to how to get started?
The easiest option is to implement a binary heap based on C arrays.