Question
Question 2 (1 point) Select all the options below that are true about DLLists. Question 2 options: a) DLLists have O(n) (i.e. bad) insertions at
Question 2 (1 point)
Select all the options below that are true about DLLists.
Question 2 options:
|
|
a) | DLLists have O(n) (i.e. bad) insertions at the front. |
|
|
b) | DLLists have O(n) (i.e. bad) removes from the front. |
|
|
c) | DLLists have O(n) (i.e. bad) setting the front element to a different value. |
|
|
d) | DLLists have O(1) (i.e. good) at insertions in the middle. |
|
|
e) | DLLists have O(1) (i.e. good) removes from the middle. |
|
|
f) | DLLists have O(1) (i.e. good) setting an element in the middle to a different value. |
|
|
g) | DLLists have O(n) (i.e. bad) insertions at the back. |
|
|
h) | DLLists have O(n) (i.e. bad) removals from the back. |
|
|
i) | DLLists have O(n) (i.e. bad) setting an element at the back to a different value. |
|
|
j) | If you have a pointer/iterator into the middle of your DLList, it is O(1) to insert into the DLList around this middle index (within a few indices to the left or right). |
|
|
k) | If you have a bunch of insertions into a DLList at indices spread out throughout the length of the List, where the indices are known in advance, individual insertions will require a lot of shifting (e.g. explicitly moving the element at index i to index (i-1) or index (i+1)), whereas making a second DLList and copying the original and inserted elements into this second list will require zero shifting. |
|
|
l) | If you have a bunch of insertions into a DLList at indices spread out throughout the length of the List, where the indices are known in advance, individual insertions will require a lot of iterations through the list, whereas keeping a pointer/iterator that iterates through the List stopping at the known indices will require only one iteration through the List. |
|
|
m) | If you have a bunch of insertions into a DLList at indices spread out throughout the length of the List, where the indices are not known in advance (i.e. you learn them as you perform your insertions), individual insertions will require more iterations through the List than keeping a pointer/iterator that iterates back and forth through the List stopping at the known indices. |
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