Stacks Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What is a stack?

A

A data structure where values are added to the top and removed from the top

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

What type of data structure is a stack?

A

Last in First Out (LIFO)

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

What error can occur when pushing an item onto the stack?

A

The stack could be full and stack overflow occurs

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

What is the difference between pop and peek?

A

Pop removes an item of the stack and returns it

Peek only looks at the top item

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