What is the big-o running time of the subsequent code


Question 1:  What is the Big-O running time of the subsequent code fragment?

    Assume lst1 has N items, and lst2 is initially empty.

   public static void add( List lst1, List lst2)

   {

      for ( Integer x : lst1 )

         lst2.add(0, x);        // add to front

   }

   a.  If an ArrayList is passed for lst1 and lst2.  Describe your answer.

   b.  If a LinkedList is passed for lst1 and lst2.  Describe your answer.

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: What is the big-o running time of the subsequent code
Reference No:- TGS0951369

Expected delivery within 24 Hours