S7 - 34 Queues Flashcards

1
Q

what is an abstract data type?

A

one that’s created by the programmer, rather than defined within the programming language

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

what do abstract data types include?

A

abstract data types include queues, stacks, trees and graphs

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

what data structure is a queue?

A

A queue is a first in first out data structure (FIFO)

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

where are new elements added?

A

New elements are added at the end of the queue

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

where are elements retrieved?

A

elements are retrieved from the front of the queue

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

the size of the queue depends on…

A

the number of items in it (like a supermarket queue)

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

how is the sequence of data items in a queue determined?

A

the sequence of data items in a queue is determined by the order in which they are inserted

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

state the uses of a queue

A

+ characters typed on a keyboard are in a queue in a keyboard buffer

+ output waiting to be printed is commonly stored in a queue on a disk (first come first serve)

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

what are the operations that can be performed on a queue?

A

+ enQueue(me) # adds the string me to the queue

+ deQueue() # removes the item at the front of the queue

+ isEmpty() # test to see wether queue is empty

+ isFull() # test to see wether queue is full

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

what happens when an item is added or removed from a queue?

A

When an item is removed the front pointer moves to the next item closest to the front.

When an item is added, the rear pointer moves to the next item closest to the rear.

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

define dynamic data structure

A

A dynamic data structure refers to a collection of data in memory that has the ability to grow or shrink

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

what is the heap?

A

The heap is a portion of memory from which space is automatically allocated or de-allocated as required

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

why is a dynamic data structure useful?

A

Dynamic data structures are useful for implementing data structures (such as queues) when the maximum size of the data structure is not known in advance

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

how can memory overflow be avoided in a queue?

A

The queue can be given some arbitrary maximum to avoid causing memory overflow

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