12,999,653 members (38,871 online)
Rate this:
See more:
Consider the following stack of characters,where stack is allocated 8 memory cells. Stack:a,9,e,,,,,_, Give the contents of the stack at the end of the each operation given below: i).pop() ii).pop() iii).push(e) iv).push(1) v).pop() vi).push(i) vii).push(0) viii).pop() ix).push(o) x).push(u)
Posted 2-Nov-11 18:46pm
Updated 2-Nov-11 19:55pm
v2
Vivek Krishnamurthy 3-Nov-11 1:16am

What is the question ?
CodeHelper_PS 3-Nov-11 1:25am

Peter_in_2780 3-Nov-11 1:51am

He only recycled the title. Probably the name of the course he want us to do the homework for.
Legor 3-Nov-11 5:07am

Choose another career

Rate this:

## Solution 1

If you are going to post your homework, at least try to make it look like you have attempted to do something yourself!

We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

Try it yourself, or learn the Magic Words: "Do you want fries with that?"
Rate this:

## Solution 2

Stack stands for LIFO (Last in First Out).
So assuming a,9,e,,,,,_, a is at the bottom.
i).pop() //removes _
a,9,e,,_,,_,
ii).pop() //removes _
a,9,e,,_,,
a,9,e,,_,,e,
a,9,e,,_,,e,1,
v).pop()
a,9,e,,_,,e,
vi).push(i)
a,9,e,,_,,e,i,
vii).push(0)
a,9,e,,_,,e,i, (Not pushed as stack overflow)
viii).pop()
a,9,e,,_,,e,
ix).push(o)
a,9,e,,_,,e,o,
x).push(u)
a,9,e,,_,,e,i, (Not pushed as stack overflow)

Top Experts
Last 24hrsThis month
 RickZeeland 185 OriginalGriff 50 Michael_Davies 40 Bharat Leel 35 Jochen Arndt 30
 OriginalGriff 4,547 ppolymorphe 2,292 RickZeeland 2,158 Kornfeld Eliyahu Peter 1,973 Richard Deeming 1,593