Write an algorithm of insertion (push) using array in stack

Algorithm:

Push(Stack,N,Top,value)
(1)[Start]
(2)[Check for Full]
If Top= N-1
Show “Stack is Full”
Return
Else
Top=Top+1
[End Of If Else step 2]
(3) Stack[Top]= Value
(4) [Return]

Leave a Reply

Your email address will not be published. Required fields are marked *