3. STACK: POP item [ANIMATED] with ALGORITHM and CODE | Data Structure Full Course

Опубликовано: 07 Октябрь 2024
на канале: PSN Academy
16
0

The algorithm:
POP(STACK, TOP, ITEM)
This procedure deletes the top element of STACk and assigns it to the variable ITEM.
1. [Stack has an item to be removed?]
If TOP := 0, then: Print: UNDERFLOW, and Return.
2. Set ITEM := STACK[TOP]. [Assigns TOP element to ITEM.]
3. Set TOP := TOP — 1. [Decreases TOP by 1.]
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.