Priority Queue

Nov 29, 2010 at 6:45pm
I'm having some trouble with priority queues.

I am trying to store a name and time-stamp into a priority queue.

For example:

(Bob, timestamp), (Carol, timestamp), (Cindy, timestamp)

Should I use a class to store both the name and time, and then push that into the queue?

I am eventually going to pop out the names by earliest and latest time, but I am more worried about actually getting them into the queue right now.

Thank you.
Nov 29, 2010 at 7:02pm
I'd say yes, use a struct\class of some type and push that into the queue. This will help you sort them at least as you only have to evaluate one element of the set at a time then you can move the entire object in one operation.
Topic archived. No new replies allowed.