68 245
Assignments Done
Successfully Done
In November 2018

Answer to Question #78885 in C for Sam

Question #78885
What is the top element in the stack S.
Stack(S); //create a stack S
Queue(Q); //create a queue Q
Push (S,1); Push(S,2);
Push (S,3); Push(S,4);
Enqueue(Q,5); Enqueue(Q,6);
For (i=1) to 4) {
X=Pop (S);
For (i=1 to 6) {
Z=Dequeue (Q);
Expert's answer
There are two possible answers:
1. 1, If in the second cycle there is a misprint ( Z=Dequeue (Q); Push(S,x); ), where Z should be pushed
2. 4, If everything is correct, x is last popped element from previous cycle

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions