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

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

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

>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

;)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.