public static LinkedList doLinkedListSearchSmallestint numIt

   public static LinkedList<Integer> doLinkedListSearchSmallest(int numItems) {

       System.out.print(\"doLinkedListSearchSmallest: \");

       LinkedList<Integer> list = new LinkedList<>();

          for(int i=0; i<numItems-1; i++){

       list.add(0);}

       long startTime = getTimestamp();

       // TODO Write code that gets the element at the first index from list.

       long endTime = getTimestamp();

       long totalTime = endTime - startTime;

       System.out.println(totalTime);

      

       return list;

   }

Solution

Here i am just providing the TODO part as only thats expected.

We can get element at first index as below:

List stores element as object so

list.getFirst(); // function predefined

 public static LinkedList<Integer> doLinkedListSearchSmallest(int numItems) { System.out.print(\

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site