STACK-EMPTY(S)
1 if S.top == 0
2 return TRUE
3 else return FALSE
PUSH(S , x)
1 S.top = S.top + 1
2 S[S.top] = x
POP(S)
1 if STACK-EMPTY(S)
2 error “underflow”
3 else S.top = S.top – 1
4 return S[S.top + 1]
illustrate the result of each operation in the sequence $PUSH(S,4), PUSH(S,1),PUSH(S,3),POP(S),PUSH(S,8),POP(S)$ on an initially empty stack $S$ stored in array $S[1...6]$