Discuss the below:
Q: Declare a stack, queue, and priority queue of integers, as follows:
stack s;
queue q;
priority_queue pq;
Assume that you input the integer sequence
5 8 12 15 1 3 18 25 18 35 2 55
and insert each value into each container in the order given. What is the output of the following statements?
while (!s.empty())
{
cout << setw(5) << s.top() << setw(5)
<< q.front() << setw(5)
<< pq.top() << endl;
s.pop(); q.pop(); pq.pop();
}