Stacks Flashcards

1
Q

In what order are items added to and removed from a stack?

A

Last in - first out (LIFO)

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

List the functions of these following operations:
- Create
- Delete
- Push
- Pop
- Peek
- isEmpty
- isFull
- currentSize

A
  • Create a new stack object
  • Delete a stack object
  • Push an element to the top of a stack
  • Pop an element from the top of a stack
  • Peek the value of the top element, leaving the stack unchanged
  • isEmpty to check if the stack is currently empty
  • isFull to check if the stack is currently full
  • currentSize a useful operation to report how many items present
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How are Stacks useful for recursion?

A

The operating system uses a stacks to control memory during recursive processes (adds new processed to top of stack, giving them priority)

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