Stacks Flashcards

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

Definition

A

Based on an array but just have one pointer - a top pointer

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

Type of data structure

A

First in, last out (FILO)

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

Example to remember the type of data structure

A

Students placing books down for a teacher to mark.

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

Operations that can be performed.

A
Push (add an item) 
Pop (remove an item)
Peek 
Isfull
Isempty
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the peek function

A

Returns the value at the top of the stack without actually removing it.

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

The pop operation can be used to

A

Assign variables and constants.
e.g. operation:
x

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

Peek operation can be used to

A

Assign variables and constants.

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

Stack overflow definition

A

When there are no available spaces left on the stack

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

Stack underflow definition

A

When you try to use the pop command on an empty stack.

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