The algorithm:
PUSH(STACK, TOP, MAXSTK, ITEM)
This procedure pushes an ITEM onto a stack.
1. [Stack already fllled?]
If TOP := MAXSTK. then: Print: OVERFLOW, and Return.
2. Set TOP := TOP + 1. [Increases TOP by 1].
3. Set STACK[TOP] := ITEM. [Inserts ITEM in new TOP position.]
4. Return.
My socials:
[email protected]
https://psnacademy.in
/ psnayak
/ psnayakeducator
https://www.buymeacoffee.com/psnayak
/ psnayak2007
Note: This video is copyrighted, no part of it to be reproduced or republished.