Stacks And Queues Flashcards

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

Are stacks FIFO or FILO?

A

FILO

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

Which function adds an item to a stack?

A

Push

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

Which function removes an element from a stack?

A

Pop

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

What is the significance of the back pointer in the array representation of a queue?

A

Holds the location of the next available space in the queue

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

Which function returns the item at the front of a queue without removing it?

A

Peek

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

What is the purpose of the front pointer in the array representation of a queue?

A

Points to the space containing the first item in the queue

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

What value is the top pointer initialised to in the array representation of a stack?

A

-1

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

Give pseudocode for the function which adds new elements to stacks.

A

Stacks: pushelement; top = top + 1

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

Give pseudocode for the function which adds new elements to queues.

A

Queues: enqueueelement; back = back + 1

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

Which function returns the item at the top of a stack without removing it?

A

Peek

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