Unit 2 Chapter 4 Stacks and Queues Terms & Concepts Flashcards

1
Q

Stacks

A

allow access to only one data item: the last item inserted

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

Stack: FIFO or LIFO storage mechanism?

A

LIFO: Last In First Out

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

Stack: terms for adding and taking away items.

A

Push and pop.

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

Stack are Restricted, which means:

A

can’t access elements using an index.

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

The Peek function in a stack does what?

A

read the value from the top of the stack

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

Stack: Delimiter Matching function does what?

A

pairs of delimiters that are opened last should be closed first. Works using LIFO property of stack.

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

Queue: FIFO or LIFO storage mechanism?

A

FIFO: First In FIrst Out

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

Queue: terms for adding and taking away items.

A

insert and remove

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

Circular Queue function

A

front and rear “wrap around” to the beginning of the array.

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

Broken Sequence definition

A

the items in the queue are in two different sequences in the array.

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

Contiguous Sequence definition

A

items in the queue are in a single unbroken sequence in the array.

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

what is rear set to when insert( ) method wraps around from the top of the array to the bottom of the array in a circular queue?

A

rear is set to -1.

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

Deque definition

A

a double-ended queue, you can insert items at either end and delete them from either.

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

Priority Queue definition

A

items are ordered by key value so that the item with the lowest key (or highest key in some implementations) is always at the front. Items are inserted in proper position to maintain order. items with smaller keys are shifted up to make room.

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

Ascending-priority queue definition

A

the item with smallest key has the highest priority and is accessed with remove( ).

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

Priority queue speed is faster with an array or a heap?

A

heap