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 al, LinkedList ll,

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 al, LinkedList ll,

int key)

{

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!