Question: Please help me with this Java problem . Take your time! 1.The sum_getImple Method /** * Get the total of the values in an integer
Please help me with this Java problem . Take your time!


1.The sum_getImple Method
/** * Get the total of the values in an integer list * @param nums The list of integers * @return The sum of the values */ public int sum_getImple(java.util.List nums) { int total = 0; for(int i = 0; i
2.The sum_iteratorImple Method
/** * Get the total of the values in an integer list * @param nums The list of integers * @return The sum of the values */ public int sum_iteratorImple(java.util.List nums) { int total = 0; java.util.Iterator it = nums.iterator(); while(it.hasNext()) { total += it.next(); } return total; }
3.The removeEvens_getImple Method
/** * Remove the even values from a list of integers. * The method modifies the parameter list. * @param nums The list of integers */ public void removeEvens_getImple(java.util.List nums) { for(int i = 0; i
4.The removeEvens_iteratorImple Method
/** * Remove the even values from a list of integers. * The method modifies the parameter list. * @param nums The list of integers */ public void removeEvens_iteratorImple(java.util.List nums) { java.util.Iterator it = nums.iterator(); while(it.hasNext()) { int value = it.next(); if(value % 2 == 0) { it.remove(); } } }
5.The double_getImple Method
/** * Double the values in a list of integers. * This method modifies the parameter list. * @param nums The list of integers */ public void double_getImple(java.util.List nums) { for(int i = 0; i
6.The double_iteratorImple Method
/** * Double the values in a list of integers. * This method modifies the parameter list. * @param nums The list of integers */ public void double_iteratorImple(java.util.List nums) { java.util.ListIterator it = nums.listIterator(); while(it.hasNext()) { int value = it.next(); it.set(2 * value); } }
The format of the answer should look like something like included explaining in a txt file.
When nums is an ArrayList, the sum_getImple method is O( When nums is an LinkedList, the sum_getImple method is O( When nums is an ArrayList, the sum_iteratorImple method is O( When nums is an LinkedList, the sum_iteratorImple method is O(
....
In this assignment, you will consider several algorithms which use the methods of java.util.List, giving the algorithmic efficiency and a brief description of the reason. The algorithms are encoded in standard Java methods which have a java.util.List parameter. The analysis shall consider what the Big-O for the method will be when passed an instance of java.util.ArrayList and when passed an instance of java.util.LinkedList An Example Let's look at an example of what you will be doing for this assignment. Consider the following simple method: * Add tuo elements of a list of Integers eparam nums The list of integers @param index! The first index value @param index2 The secdond index value t @return The sum of the two elements @throvs Illega 1 Argument Exception when index values t are out of range public int addTwo (java.util.List
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
