Follow

Translate

Thursday, March 17, 2016

We simulate the operation PUSH(STACK, ITEM)

(b)  We simulate the operation PUSH(STACK, ITEM):

1.  Since TOP = 3, control is transffered to Step 2.

2.  ITEM = ZZZ.

3. TOP  = 3 - 1 = 4.

4.Return.
Observe That STACK[TOP] = STACK[2] = YYY is now the top element in the stack

0 comments:

Post a Comment