T/F exam #2
A list is an object whose data consists of unordered entries.
False
A recursive method uses less memory than an iterative method.
False
Adding a node at the end of a chain of n nodes is the same as adding a node at position n.
False
An iterative solution to the Towers of Hanoi problem moves fewer disks than the recursive solution.
False
Divide and conquer algorithms can only be written recursively.
False
Exchanging two objects in an array requires the compareTo method.
False
Implementing the insertion sort for an array of elements is generally difficult.
False
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 linked implementation of a list, the replace method replaces the entire node.
False
In an array-based implementation of the ADT list, entries must be ordered alphabetically.
False
In an array-based implementation of the ADT list, entries must be ordered numerically.
False
In an array-based implementation of the ADT list, the makeRoom method does the most work when newPosition is n.
False
Merge sort is only efficient for sorting a small number of items if you only need to sort a large array once.
False
Performance of the selection sort depends on how scrambled the data is before starting.
False
Radix sort is a general-purpose sorting algorithm.
False
Recursive method calls create multiple copies of the method in memory.
False
Recursive methods do not return a value.
False
Retrieving a list entry using a linked implementation is faster than using an array representation.
False
Selection sort is efficient for large arrays.
False
Sorting a chain of linked nodes is usually easier than sorting an array
False
The ADT list only works for entries that are strings.
False
The ADT list specifies the order of the entries.
False
The Java Class Library implementation of the interface list return null when an index is out of range.
False
The Queue interface extends the Deque interface.
False
The entries of a list are numbered from 0 to n.
False
The first entry is a list is at position 0.
False
The iterative merge sort algorithm is much simpler than the recursive algorithm
False
The quick sort algorithm always divides an array in half.
False
Unlike a stack, a queue does not restrict access to its entries.
False
When you use a vector to implement the ADT list, retrieving an entry at a given position is slow.
False
When you use an array to implement the ADT list, retrieving an entry at a given position is slow.
False
You cannot partition a chain of linked nodes.
False
You cannot use a recurrence relation to estimate the time efficiency of the recursive merge sort algorithm because there are two recursive calls in the method.
False
You cannot use an assert statement to determine of a list is empty.
False
You must know how much memory to allocate before creating a linked implementation of a list.
False
You need two external references for a circular doubly linked chain, one for the firstNode and one for the lastNode.
False
You should always trace a recursive method to ensure it is correct.
False
The final step of shell sort in a selection sort.
Fasle
A disadvantage of merge sort is the need for a temporary array during the merge step.
True
A fundamental operation of a list is a traversal.
True
A linked implementation of a list grows and shrinks dynamically as nodes are added and deleted.
True
A priority queue cannot have null entries
True
Activation records for recursive methods are the same as activation records for non-recursive methods.
True
Adding a node to an empty chain is the same as adding a node to the beginning of a chain.
True
Adding entries to the end of a list does not change the positions of entries already in the list.
True
Converting a tail-recursive method to an iterative method is usually a straightforward process.
True
Divide and conquer algorithms typically use two or more recursive calls.
True
Each entry is a list ADT is uniquely identified by its position within the list.
True
Each node in an ordinary linked chain references only the next node.
True
Implementing the insertion sort for a linked chain of nodes is generally difficult.
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 a linked implementation of a list, you only call the method getNodeAt when we remove an entry other than the first one.
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
In quick sort, the choice of pivots affects its behavior.
True
In quick sort, the partition places the pivot in the position that it will occupy in the final sorted array.
True
In the makeRoom method of the array-based implementation of the ADT list, it is possible that no items will be shifted.
True
Insertion sort is not efficient for large arrays.
True
Merging two arrays requires an additional array.
True
Methods in a vector based implementation of the ADT list are functionally similar to methods in an array based implementation of the ADT list.
True
Methods in a vector based implementation of the ADT list have different specifications than methods in an array based implementation of the ADT list.
True
Objects in an array to be sorted must be of the same class.
True
Queues are used in operating systems.
True
Replacing a list entry using an array implementation is faster than using a linked representation.
True
Replacing a node in a linked implementation of a list only requires locating the node and replacing the data portion of the node.
True
Shell sort is based on insertion sort.
True
The ADT list is more general than common lists and has entries that are objects of the same type.
True
The ArrayDeque class implements the Stack interface.
True
The Java Class Library ADT PriorityQueue uses the compareTo method to determine how to order entries.
True
The Java Class Library contains an implementation of the ADT list that uses a resizable array instead of a linked chain.
True
The Java Class Library interface for Queue has no operation to modify the contents of the front entry.
True
The efficiency of the displayList method is directly related to the efficiency of the getEntry method.
True
The item most recently added to a queue is at the back of the queue.
True
The merge sorts in the Java Class Library are stable.
True
The null value can be used to signal failure to remove or retrieve an entry from a priority queue when it is empty.
True
The program stack stores activation records chronologically.
True
The radix sort restricts the data that it sorts on.
True
The recursive selection sort performs the same operators as the iterative method.
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 a programmer implements an ADT list, clients can use the ADT's operations in a program without knowing how the programmer implemented the list to be able to use it.
True
When you use a vector to implement the ADT list, adding an entry at a the end of the list is fast.
True
When you use an array to implement the ADT list, adding an entry at a the end of the list is fast.
True
You can push, pop and get items at either end of the ADT deque.
True
You can replace recursion with iteration by simulating the program stack.
True
You can use a recurrence relation to determine the performance of a recursive method.
True
You may replace an entry at any given position in a list.
True
You need a temporary variable to reference nodes as you traverse a list.
True
