Chapter 11 - Queue, Deque, and Priority Queue Implementations

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

You need two external references for a circular doubly linked chain, one for the firstNode and one for the lastNode.

False

When adding a node to a two-part circular linked chain implementation of a queue

first check if a node is already available in the chain.

In a circular array-based implementation of a queue, frontIndex is equal to one less than backIndex when the queue is full.

False

In a circular array-based implementation of a queue, the available locations are not contiguous.

False

In a linked chain implementation of a queue, the enqueue operation could potentially be dependent on the other entries and will require a search.

False

In a linked chain implementation of a queue, the enqueue operation requires a traversal to the end of the chain to insert a new entry onto the queue.

False

In a circular array-based implementation of a queue, what is the performance when the enqueue operation does not resize the array?

O(1)

In a circular array-based implementation of a queue, what is the performance when the enqueue operation if you amortize the cost of resizing the array over all additions to the queue?

O(1)

In a doubly linked chain implementation of a queue, what is the performance when the dequeue operation ?

O(1)

In a linked chain implementation of a queue, the performance of the enqueue operation is

O(1)

In a linked chain implementation of a queue, the performance of the getFront operation is

O(1)

In a two-part circular linked chain implementation of a queue, what is the performance when the dequeue operation ?

O(1)

In a circular array-based implementation of a queue, what is the performance when the enqueue operation must resize the array?

O(n)

Each node in an ordinary linked chain references only the next node.

True

In a circular array-based implementation of a queue, frontIndex is equal to one more than backIndex when the queue is empty.

True

In a circular array-based implementation of a queue, you cannot use only frontIndex to determine when a queue is full.

True

In a linked chain implementation of a queue, when both the firstNode and lastNode entries are null, the chain is empty.

True

In an array-based implementation of a queue, inserting and deleting entries is accomplished using modulo arithmetic.

True

In an array-based implementation of a queue, keeping the front entry of the queue at queue[0] is inefficient.

True

When a circular linked chain has one node, the node references itself.

True

When a circular linked chain is used to represent a queue, it is not necessary to maintain a firstNode data field.

True

When adding a node to a two-part circular linked chain implementation of a queue we insert the new node into the chain

after the node that freeNode references

In an array-based implementation of a queue, a possible solution to dealing with the full condition is to

leave one array location unused

A linked chain whose last node is null is sometimes called a(n)

linear linked chain

In an array-based implementation of a queue, a possible solution to dealing with the full condition is to

maintain a count of queue items

In a linked chain implementation of a queue, an external reference to the last node in the chain is called a(n)

tail reference

To efficiently remove a node at the end of a linked chain implementation of a queue requires as

tail reference

In the linked chain implementation of a queue, the chain's tail last node contains

the queue's back entry

In the linked chain implementation of a queue, the chain's first node contains

the queue's front entry

In a circular array-based implementation of a queue implementation where one unused location is used to differentiate between the front and back of the queue, the frontIndex is _____ than the backIndex.

two more

When would you choose a two-part circular chain over a circular chain?

when you frequently add an entry after removing one

In a circular linked chain, when a node is removed from the queue

it is deallocated

In a circular array-based implementation of a queue, what is the performance when the dequeue operation ?

O(1)

A two-part circular linked chain implementation of a queue

Conceptually has two lists. Uses a freeNode reference for the first available node that follows the queue. Has node that form the queue followed by node that are available for use in the queue

A two-part circular linked chain implementation of a queue

Is initialized with no available nodes. Keeps node that are deallocated for future use. Allocates new nodes on demand when there are no available nodes.

When removing a node from a two-part circular linked chain implementation of a queue

The entry at the front of the queue is returned. The node is moved to the part of the chain that is available for the enqeue method. The queueNode is advanced.

In a linked chain implementation of a queue, when the queue is empty

The firstNode is null. The lastNode is null.

If we use a chain of linked nodes with only a head reference to implement a queue which statement is true?

You must traverse the entire chain to access the last node. Accessing the last node is very inefficient.

In an array-based implementation of a queue, if waitingListis the name of the array, and the index to the last entry in the queue is called backIndex, write a single assignment statement to update backIndexto add an entry to the queue.

backIndex = (backIndex + 1) % waitingList.legnth;

In a circular array-based implementation of a queue, if waitingList is the name of the array, and the index to the last entry in the queue is called backIndex, write a single assignment statement to update backIndex to add an entry to the queue.

backIndex = (backIndex + 2) % waitingList.length;

In a circular array-based implementation of a queue, explain why checking for frontIndex equal to backIndex + 1 does not work.

because it is indistinguishable from an empty array condition.

How can we tell if a two-part circular linked chain queue is empty?

both the queueNode and freeNode reference the same node

An array whose index of the first location follows the index its last one is call

circular

In a ______ the last node references the first node.

circular linked chain

When a linked chain contain nodes that reference both the next node and the previous node, it is called a(n)

doubly linked chain

In a circular array-based implementation of a queue, if waitingList is the name of the array, and the index to the last entry in the queue is called frontIndex, write a single assignment statement to update frontIndex to remove an entry to the queue.

forntIndex = (frontIndex - 2) %waitingList.length;

In an array-based implementation of a queue, if waitingList is the name of the array, and the index to the last entry in the queue is called frontIndex, write a single assignment statement to update frontIndex to remove an entry to the queue.

frontIndex = (frontIndex - 1) % waitingList.length;

In a circular array-based implementation of a queue, the initial size of the array should be

one more than the queue's initial capacity

In a two-part circular linked chain implementation of a queue

queueNode references the front node of the queue. freeNode references the node that follows the queue. the queue is empty if queueNode equals freeNode.


Kaugnay na mga set ng pag-aaral

Honan-Chapter 26: Nursing Assessment: Renal and Urinary Tract Function

View Set

Chapter 1: The Individual Tax Return

View Set

STRA 5370 - Chapter 7: Vertical Integration and Outsourcing Quiz

View Set