Stack Flashcards

1
Q

What is a stack?

A

A stack is a linear data structure which follows LIFO structure
eg. browser last button

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly