Abhishek  Jaiswal

Abhishek Jaiswal

  • 94
  • 19.8k
  • 9.6m

Program in JAVA

Mar 30 2014 6:16 AM

POP operation

.
POP(STACK,TOP, ITEM)
This procedure deletes the top element of STACK and assigns it to the variable ITEM.
1. [Stack han an item to be removed?]
if TOP =0, then: print: UNDERFLOW, and Return.
2. set  ITEM := STACK[TOP]. [Assigns TOP element to ITEM.]
3. set TOP := TOP -1.[Decreases TOP by 1.]
4 Return.

Answers (1)