Question: 1) For the implementations given in this course, what is the worst case running time of the get(int index) method for the LinkedList class? A)
1) For the implementations given in this course, what is the worst case running time of the get(int index) method for the LinkedList class?
A) O(N/2)
B) O(N)
C) None of the above.
D) O(1)
2) Given the following collection of integers stored in a LinkedList:
3, 8, 23, 1, 900, 45, 16, 37, 54, 278, 6
suppose you have an iterator traversing the list, and that this iterator is currently pointing to the item, '16'. Before the iterator moves to the next item in its traversal, suppose the integer 92 is added at position 7 of the list, between the 16 and the 37, using the add(Object obj, int index) method of the LinkedList class. What value will the iterator be pointing to after the '92' has been added?
A) no value
B) 37
C) 16
D) 92
3) For the implementations given in this course , what is the best case running time of the remove(int index) method for the LinkedList class?
A) (N)
B) (1)
C) None of the above.
D) (N/2)
4) For the implementations given in this course, what is the worst case running time of the remove(Object obj) method for both the ArrayList and LinkedList classes?
A) O(1)
B) O(N)
C) None of the above.
D) O(N/2)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
