Question: 1. Suppose we define a static method totalEvenLocation that returns the total of even-index items of an integer List as below: public static int totalEvenLocation(
1. Suppose we define a static method totalEvenLocation that returns the total of even-index items of an integer List as below: public static int totalEvenLocation( List
What is the Big-O running time of the method if lst is an LinkedList of size N?
select one:
a) O(1) b) O(logN) c) O(N) d) O(NLogN) e) O(N2)
2. Suppose we define a static method totalEvenLocation that returns the total of even-index items of an integer List as below: public static int totalEvenLocation( List
What is the Big-O running time of the method if lst is an ArrayList of size N?
select one:
a) O(1) b) O(logN) c) O(N) d) O(NLogN) e) O(N2)
3. Given the following definition of ListNode constructor (similar to the one we have in our doubly-linked list example). public ListNode (T v, ListNode
Which statement inserts an item x after position "current"?
select one:
a) current = new ListNode(x, current); b) current = new ListNode(x, current.next); c) current.next = new ListNode(x, current); d) current.next = new ListNode(x, current.next); e) none of the above
4. Suppose we define a method removeHalf that removes the first half of a List (or slightly less than one-half of the list if odd length) as below: public static void removeHalf( List
select one:
a) only size b) only lst.size() c) either size or lst.size() would work d) neither size nor lst.size()
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
