Op1:

enqueue (Q2, x);

while (! IsEmpty (Q1))

enqueue (Q2, dequeue(Q1));

swap the name of Q1 and Q2;

Op2: return (dequeue (Q1));

where Q1 and Q2 are two queues and x is the element inserted into the queue.

What does the two operations Op1 and Op2 do.

1
Reversing elements of Queue
2
Printing elements if Queue  in reverse without  changing Queue contents
3
Implementation of stack using Queue
4
Printing elements of Queue

Sponsored

hivanix.in

Visit

This quiz is brought to you by hivanix.in

🌐 Web App Development

Quick Navigation