Stack Flashcards
1
Q
What is a stack?
A
A stack is a linear data structure which follows LIFO structure
eg. browser last button
2
Q
common operation on the stack?
A
- Create a stack
- push
- pop
- peek: (Does not remove the element from the stack only - return the value)
- isEmpty
- isFull (if an array implementation)
- Delete Stack
3
Q
How can stack be implemented?
A
Can be implemented using Array or LinkedList
Array:
pros: easy to implement
cons: fixed in size
LL:
pros: dynamic in size cons: moderate to implement