typedefstruct {
string state;
string parent;
string action;
int pathcost;
int depth;
} node;
I need to create a priority queue based on this, which will prioritize based on the pathcost value. I can't find much on this. Also, if you know how this can be passed as a parameter recursively, I appreciate any code help there. Thanks for your time.
A queue is a first-in-first-out(FIFO) data structure.
A priority queue just bumps up elements as they are inserted to the end of their priority line.
Thinks of a priority queue having multiple waiting "lines" each with their own priority.
So when a new person comes along to wait he/she would wait at the end of the appropiate line based on their priority.
The queue would store all these waiting "lines" in one list sorted by priority.
You need a comparison function between two structures which orders them by pathcost. You can add operator< to your class or have a separate comparison function