Abhishek  Jaiswal

Abhishek Jaiswal

  • 95
  • 19.8k
  • 9.6m

Program in JAVA

Mar 29 2014 2:31 PM

ALGO 1..
PUSH(STACK,TOP,MAXSTK,ITEM)
This procedure pushes an ITEM onto a stack.
1.[Stack already filled?]
if TOP = MAXSTK, then: print: OVERFLOW, and return.
2. Set TOP:= TOP+1. [INCREASE TOP BY 1]
3. Set STACK[TOP]:= ITEM.[inserts ITEM in new TOP position.]
4. Return.

Answers (2)