2
Answers

Program in JAVA


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)