For PUSH Operations:-
1.[Check for stack overflow]
If TOP ≥ N
Then write (‘STACK OVERFLOW’)
Return
2. [Increment TOP]
TOP ←TOP + 1
3. [Insert Element]
S[TOP] ←X
4. [Finished]
Return
For POP Operations:-
1. [Check for underflow of stack]
If TOP = 0
Then Write (‘STACK UNDERFLOW ON POP’)
Take action in response to underflow
Return
2. [Decrement Pointer]
TOP ← TOP – 1
3. [Return former top element of stack]
Return (S[TOP + 1])