Question: Following is a C like pseudo-code of a function that takes a queue as an argument and uses a stack S to do the processing.
Following is a C like pseudo-code of a function that takes a queue as an argument and uses a stack S to do the processing.


What does the above function do in general?
A. Removes the last from Q
B. Keeps the Q the same as it was before the call
C. Makes Q empty
D. Reverses the Q
void fun (Queue *Q) { to S Stack S; // Say it creates an empty stack S // Run while Q is not empty while (!isEmpty (Q)) { // deQueue an item from Q and push the dequeued item push (&S, deQueue (Q)); } // Run while Stack S is not empty
Step by Step Solution
3.40 Rating (156 Votes )
There are 3 Steps involved in it
D Explanation The function takes a queue Q as an ... View full answer
Get step-by-step solutions from verified subject matter experts
