Question: I'm strugglign with constructing the methods below. /** * Compares the execution time of performing linear search on an * ArrayList vs a LinkedList. Finds
I'm strugglign with constructing the methods below.
/**
* Compares the execution time of performing linear search on an
* ArrayList vs a LinkedList. Finds the number of nano-seconds taken to
* perform the search on an ArrayList, then finds the number of nano-seconds
* taken to perform the search on a LinkedList. Returns the difference between
* time taken by ArrayList and LinkedList (ArrayListTime - LinkedListTime).
* The contents of both lists must be identical.
*
* @param al - Reference to a populated ArrayList
* @param ll - Reference to a populated LinkedList
* @param key - Value to search for
* @return Difference in time taken between ArrayList and LinkedList
*/
public static long compareLinearSearch(ArrayList
int key)
{
}
/**
* Compares the execution time of performing binary search on an ArrayList vs a LinkedList.
* Finds the number of nano-seconds taken to perform the search on an ArrayList,
* then finds the number of nano-seconds taken to perform the search on a LinkedList.
* Returns the difference between time taken by ArrayList and LinkedList
* (ArrayListTime - LinkedListTime). The contents of both lists must be identical.
*
*
* @param al - Reference to a populated ArrayList
* @param ll - Reference to a populated LinkedList
* @param key - Value to search for
* @return Difference in time taken between ArrayList and LinkedList
*/
public static long compareBinarySearch(ArrayList
int key)
{
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
