Stacks Flashcards

1
Q

What is a stack?

A

A last in first out (LIFO) data structure where the last item to be added/pushed is the first item to be removed/popped

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are some uses of stack:

A
  • Performing depth first search (DFS) on graphs
  • Backtracking algorithms
  • Keeping track of users inputs for undo operations
  • Used by processor to track flow of programs
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a stack overflow ?⚠️

A

A stack overflow is an attempt to push an item onto a full stack

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is a stack underflow? ⚠️

A

A stack underflow is an attempt to pop of an item of an empty stack

How well did you know this?
1
Not at all
2
3
4
5
Perfectly