Stacks Flashcards

(6 cards)

1
Q

1) Stack - Definition

A stack is a d__________ set.
When we delete an element from a stack, it is the last element in the list. LIFO = Last In First out.

When we insert an element into a stack it goes at the end (on the tail).

A

dynamic

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

2) How to Implement Stacks

There are several efficient ways to implement stacks, for now, we will be using a________.

A

array

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

3) Operations

The insert operation is called = p_______

The delete operation is called = p______

To check if our stack is empty we use = S_____-E_______

They all take O(1) time.

A

push
pop
STACK-EMPTY

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

4) S.top

When we create a stack using an array, we need to create a pointer
(a variable) called S.top that points to the most recently inserted element.

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

Underflow and Overflow

If we try to PUSH a new item into a list that is full, it is called O___________.

If we try to delete an item from an empty list it is called U__________

A

overflow
underflow

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