Question
Please help me on all the questions !!!!!!!! Really need help! Will give a thumb up for helping. True/False (11) Chapter 13 - A List
Please help me on all the questions !!!!!!!! Really need help! Will give a thumb up for helping.
True/False (11)
Chapter 13 - A List Implementation That Uses an Array
-
The ADT list specifies the order of the entries.
-
In the makeRoom method of the array-based implementation of the ADT list, it is possible that
no items will be shifted.
-
In an array-based implementation of the ADT list, the makeRoom method does the most work
when newPosition is n.
-
When you use an array to implement the ADT list, retrieving an entry at a given position is slow.
-
When you use an array to implement the ADT list, adding an entry at a the end of the list is fast.
-
When you use a vector to implement the ADT list, retrieving an entry at a given position is slow.
-
When you use a vector to implement the ADT list, adding an entry at a the end of the list is fast.
-
In an array-based implementation of the ADT list, entries must be ordered alphabetically.
-
In an array-based implementation of the ADT list, entries must be ordered numerically.
-
Methods in a vector based implementation of the ADT list are functionally similar to methods in
an array based implementation of the ADT list.
-
Methods in a vector based implementation of the ADT list have different specifications than
methods in an array based implementation of the ADT list.
Short Answer (7)
-
If colorList is an array-based ADT list and the front of the list is on the left, show the contents of the list after applying the following code?
colorList.add(red) colorList.add(purple) colorList.add(green) colorList.add(3, yellow) my colorList List.add(1, black) colorList.add(4, blue)
-
If colorList is an array-based ADT list and the front of the list is on the left, show the contents of the list after applying the following code?
colorList.add(red) colorList.add(1, purple) colorList.add(1, green) colorList.add(1, yellow)
my colorList List.add(1, black) colorList.add(blue)
-
If colorList is an array-based ADT list and the front of the list is on the left, show the contents of the list after applying the following code?
colorList.add(red) colorList.add(2, purple) colorList.add(2, green) colorList.add(2, yellow) my colorList List.add(2, black) colorList.add(2, blue)
-
Given the following array-based ADT list called colorList whose elements contain strings red, orange, yellow, blue, indigo, violet
write the statement to insert the String element pink to the end of the list. Assume the front of the list is on the left.
-
Given the following array-based ADT list called colorList whose elements contain strings red, orange, yellow, blue, indigo, violet
write the statement to insert the String element white to the beginning of the list. Assume the front of the list is on the left.
-
Given the following array-based ADT list called colorList whose elements contain strings red, orange, yellow, blue, indigo, violet
write the statement to insert the String element green between yellow and blue. Assume the front of the list is on the left.
-
Given the following array-based ADT list called colorList whose elements contain strings red, orange, yellow, blue, indigo, violet
write the statement to take the String element blue out of the list. Assume the front of the list is on the left.
Multiple Choice (27)
1. A new entry is added to an array-based implementation of the ADT list
-
immediately after the last occupied position
-
immediately before the first occupied position
-
in the last array position
-
in the location returned by the new operator
2. When a. no shift is necessary
adding an entry to an array-based implementation of the ADT list at the end of the list
-
all of the previous elements must be shifted toward the front of the array
-
only one element is shifted toward the end of the array to make room
-
only one element is shifted toward the beginning of the array to make room
adding an entry to an array-based implementation of the ADT list at a specified location
3. When before the end of the list
a. b. c. d.
4. In the a. b. c. d.
entries must be shifted to vacate a position for the new item no shift is necessary a new entry must be allocated and linked to attach the new item the entry at the specified location will be overwritten by the new item
makeRoom method of an array-based implementation of the ADT list entries are shifted toward the end of the array beginning with the last entry entries are shifted toward the beginning of the array beginning with the last entry entries are shifted toward the beginning of the array beginning with the first entry entries are shifted toward the end of the array beginning with the first entry
makeRoom method of an array-based implementation of the ADT list no shift is necessary
5. In the if a new entry is to be placed at
a. b. c. d.
6. In the a. b. c. d.
numberOfEntries + 1 numberOfEntries 1 numberOfEntries none of the above
array-based implementation of the ADT list, the removeGap method moves each entry to its next lower position moves each entry to its next higher position swaps the first entry with the specified entry to remove
swaps the last entry with the specified entry to remove
-
When deleting an entry from an array-based implementation of the ADT list at the end of the list a. no shift is necessary
b. all of the previous elements must be shifted toward the front of the array c. only one element is shifted toward the end of the array to close the gap d. only one element is shifted toward the beginning of the array to close the gap
-
In an array-based implementation of the ADT list, what is the performance of adding an entry at
the end of the list when the array is not resized?
-
O(1)
-
O(log n)
-
O(n)
-
O(n2)
9. In an array-based implementation of the ADT list, what is the performance of adding an entry at the end of the list when the array is resized?
-
O(n)
-
O(n2)
-
O(log n)
-
O(1)
10. In an array-based implementation of the ADT list, what is the performance of adding an entry at the end of the list if you amortize the cost of resizing the array over all additions to the list?
-
O(1)
-
O(log n)
-
O(n)
-
O(n2)
-
In an array-based implementation of the ADT list, the getEntry method locates the entry by
-
going directly to the appropriate array element
-
searching for the entry starting at the beginning of the array working to the end
-
searching for the entry starting at the end of the array working to the beginning
-
none of the above
-
-
In an array-based implementation of the ADT list, the contains method locates the entry by
-
searching for the entry starting at the beginning of the array working to the end
-
searching for the entry starting at the end of the array working to the beginning
-
going directly to the appropriate array element
-
none of the above
-
-
In an array-based implementation of the ADT list, the makeRoom method does the most work when
a. newPosition is 1
-
newPosition is n
-
newPosition is n/2
-
newPosition is n-1
-
In an array-based implementation of the ADT list, what is the best case performance of the makeRoom method?
-
O(1)
-
O(log n)
-
O(n)
-
O(n2)
-
-
In an array-based implementation of the ADT list, what is the worst case performance of the makeRoom method?
-
O(n)
-
O(n2)
-
O(log n)
-
O(1)
-
-
In an array-based implementation of the ADT list, what is the best case performance of the ensureCapacity method?
-
O(1)
-
O(log n)
-
O(n)
-
O(n2)
-
-
In an array-based implementation of the ADT list, what is the worst case performance of the ensureCapacity method?
-
O(n)
-
O(n2)
-
O(log n)
-
O(1)
-
-
In an array-based implementation of the ADT list, what is the best case performance of the remove method?
a. O(1) b. O(log n) c. O(n) d. O(n2)
-
In an array-based implementation of the ADT list, what is the worst case performance of the remove method?
a. O(n) b. O(n2) c. O(log n) d. O(1)
-
In an array-based implementation of the ADT list, what is the best case performance of the replace method?
-
O(1)
-
O(log n)
-
O(n)
-
O(n2)
-
-
In an array-based implementation of the ADT list, what is the worst case performance of the replace method?
-
O(1)
-
O(log n)
-
O(n)
-
O(n2)
-
-
In an array-based implementation of the ADT list, what is the best case performance of the getEntry?
-
O(1)
-
O(log n)
-
O(n)
-
O(n2)
-
-
In an array-based implementation of the ADT list, what is the worst case performance of the getEntry method?
-
O(1)
-
O(log n)
-
O(n)
-
O(n2)
-
-
In an array-based implementation of the ADT list, what is the best case performance of the contains method?
-
O(1)
-
O(log n)
-
O(n)
-
O(n2)
-
25. In an array-based implementation of the ADT list, what is the worst case performance of the contains method?
-
O(n)
-
O(n2)
-
O(log n)
-
O(1)
26. In an array-based implementation of the ADT list, what is the performance of the contains method when the entry is not in the list?
-
O(n)
-
O(n2)
-
O(log n)
-
O(1)
27. An array provides _______ access to its elements.
-
direct
-
random
-
sequential
-
none of the above
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