0

hi,
I'll be greatful if someone tell me how to declare the preiority queue in c++ and also tell me the syntax that how we can put a node in a preority queue.
Regards
Zain

3
Contributors
4
Replies
5
Views
8 Years
Discussion Span
Last Post by Narue
0

You mean like:

#include <queue>
#include <iostream>
#include <string>

int main()
{
    std::queue<std::string> prio_q;
    std::string node = "value";
    prio_q.push(node);
    return 0;
}

Learn about queue here

0

>std::queue<std::string> prio_q;
You know the standard library has a priority_queue class too, right?

0

>std::queue<std::string> prio_q;
You know the standard library has a priority_queue class too, right?

I can act real cool and tell you : "sure I did, but I just temporarily forgot due to alcohol/lack of sleep/drugs", but to be honest: "no, I did not know that". I don't even have a proper defense why I missed such an obvious thing.

@OP: click

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.