I am trying to implement a priority queue in c++. The queue is a list of nodes that have a value and a priority, and a pointer to the next node and a pointer to the previous node in the list.
I am stuck on how to scan through the list and insert a value into the queue.
I can set a pointer variable to a node equal to the first node in the list, and then scan through to find the correct place to insert the new node. However my problem arises here: how do I set the previous nodes next pointer to the node I am trying to insert, as I have already scanned past it?
Ask if you need more