Question
True/False (13) Chapter 11 - Queue, Deque, and Priority Queue Implementations In a linked chain implementation of a queue, when both the firstNode and lastNode
True/False (13)
Chapter 11 - Queue, Deque, and Priority Queue Implementations
-
In a linked chain implementation of a queue, when both the firstNode and lastNode entries are null, the chain is empty.
-
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.
-
In a linked chain implementation of a queue, the enqueue operation could potentially be dependent on the other entries and will require a search.
-
In an array-based implementation of a queue, keeping the front entry of the queue at queue[0] is inefficient.
-
In an array-based implementation of a queue, inserting and deleting entries is accomplished using modulo arithmetic.
-
In a circular array-based implementation of a queue, frontIndex is equal to one more than backIndex when the queue is empty.
-
In a circular array-based implementation of a queue, frontIndex is equal to one less than backIndex when the queue is full.
-
In a circular array-based implementation of a queue, you cannot use only frontIndex to determine when a queue is full.
-
When a circular linked chain is used to represent a queue, it is not necessary to maintain a firstNode data field.
-
In a circular array-based implementation of a queue, the available locations are not contiguous.
-
When a circular linked chain has one node, the node references itself.
-
Each node in an ordinary linked chain references only the next node.
-
You need two external references for a circular doubly linked chain, one for the firstNode and
one for the lastNode.
Short Answer (5)
-
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 backIndex, write a single assignment statement to update backIndex to add an entry to the queue.
-
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.
-
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.
-
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.
-
In a circular array-based implementation of a queue, explain why checking for frontIndex equal to backIndex + 1 does not work.
Multiple Choice (31)
-
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.
-
Both a & b
-
None of the above
-
-
In a linked chain implementation of a queue, an external reference to the last node in the chain is called a(n)
-
tail reference
-
last node
-
linked reference
-
final node
-
-
To efficiently remove a node at the end of a linked chain implementation of a queue requires as
a. b. c. d.
-
In the a. b. c. d.
-
In the a. b. c. d.
tail reference traversal extra reference in the node pointing to the previous node none of the above
linked chain implementation of a queue, the chains first node contains the queues front entry the queues back entry both a & b
none of the above
linked chain implementation of a queue, the chains tail last node contains the queues back entry the queues front entry both a & b
none of the above
-
In a linked chain implementation of a queue, when the queue is empty
-
the firstNode is null
-
the lastNode is null
-
both a & b
-
none of the above
-
-
In a linked chain implementation of a queue, the performance of the enqueue operation is
-
O(1)
-
O(log n)
-
O(n)
-
O(n2)
-
-
In a linked chain implementation of a queue, the performance of the getFront operation is
-
O(1)
-
O(log n)
-
O(n)
-
O(n2)
-
-
An array whose index of the first location follows the index its last one is call a. circular
b. following c. round d. oval
-
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
-
check for frontIndex equal to backIndex
-
wait for an arrayFullExcetion to be thrown
-
all of the above
-
-
In an array-based implementation of a queue, a possible solution to dealing with the full condition is to
-
leave one array location unused
-
check for frontIndex equal to backIndex
-
wait for an arrayFullExcetion to be thrown
-
all of the above
-
-
In a circular array-based implementation of a queue, the initial size of the array should be
-
one more than the queues initial capacity
-
one less than the queues initial capacity
-
two more than the queues initial capacity
-
d. two less than the queues initial capacity
-
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
-
one more
-
one less
-
two less
-
-
In a circular array-based implementation of a queue, what is the performance when the enqueue operation does not resize the array?
-
O(1)
-
O(log n)
-
O(n)
-
O(n2)
-
-
In a circular array-based implementation of a queue, what is the performance when the enqueue operation must resize the array?
-
O(n2)
-
O(n)
-
O(log n)
-
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)
-
O(log n)
-
O(n)
-
O(n2)
-
-
In a circular array-based implementation of a queue, what is the performance when the dequeue operation ?
-
O(1)
-
O(log n)
-
O(n)
-
O(n2)
-
-
In a ______ the last node references the first node.
-
circular linked chain
-
array based queue
-
array based circular queue
-
d. linked chain
19. A linked chain whose last node is null is sometimes called a(n)
-
linear linked chain
-
circular linked chain
-
null terminated linked chain
-
all of the above
20. In a circular linked chain, when a node is removed from the queue
-
it is deallocated
-
it is moved to a separate list
-
it is ignored
-
none of the above
21. 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 nodes that form the queue followed by nodes that are available for use in the queue
-
all of the above
22. A two-part circular linked chain implementation of a queue
-
is initialized with no available nodes
-
keeps nodes that are deallocated for future use
-
allocates new nodes on demand when there are no available nodes
-
all of the above
23. How can we tell if a two-part circular linked chain queue is empty?
-
both the queueNode and freeNode reference the same node
-
the freeNode is one node behind the queueNode
-
the freeNode is one node in front of the queueNode
-
the empty field is set to true
24. In a two-part circular linked chain implementation of a queue
a. b. c. d.
25. When a. b. c.
queueNode references the front node of the queue freeNode references the node that follows the queue the queue is empty if queueNode equals freeNode all of the above
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 check to see if the linked chain needs resized allocate a new node and assign the reference to freeNode
d. all of the above
26. 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
-
before the node that freeNode references
-
it has nothing to do with the location of freeNode
-
none of the above
-
When
-
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 enqueue method
-
the queueNode is advanced
-
all of the above
-
-
In a two-part circular linked chain implementation of a queue, what is the performance when
the dequeue operation ?
-
O(1)
-
O(log n)
-
O(n)
-
O(n2)
30. When is called a(n)
removing a node from a two-part circular linked chain implementation of a queue
29. When
-
when you frequently add an entry after removing one
-
when you rarely add entries after removing one
-
when you are space constrained
-
when you dont want the garbage collector running
would you choose a two-part circular chain over a circular chain?
a linked chain contain nodes that reference both the next node and the previous node, it
-
doubly linked chain
-
ordinary chain
-
multi-linked chain
-
two-way linked chain
31. In a doubly linked chain implementation of a queue, what is the performance when the dequeue operation ?
-
O(1)
-
O(log n)
-
O(n)
-
O(n2)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started