https://m7madmomani2.github.io/reading-notes2
A stack is a data structure that consists of Nodes. Each Node references the next Node in the stack, but does not reference its previous.
- Push Nodes or items that are put into the stack are pushed
- Pop Nodes or items that are removed from the stack are popped. When you attempt to pop an empty stack an exception will be raised.
- Top This is the top of the stack.
- Peek When you peek you will view the value of the top Node in the stack. When you attempt to peek an empty stack an exception will be raised.
- IsEmpty returns true when stack is empty otherwise returns false.
FILO ===> First In Last Out ===> First Item added to all Last to Pop
LIFO ===> Last In First Out ===> Last Item added First to pop