What is the big-o running time of the given code fragment


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

    Assume lst has N items.

   public static void erase( List lst )

   {

      Iterator itr = lst.iterator();

      while ( itr.hasNext() )

      {

         Integer x = itr.next();

         itr.remove();

      }

   }

   a.  If an ArrayList is passed for lst. Describe your answer.

   b.  If a LinkedList is passed for lst. Describe your answer.

 

Request for Solution File

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

Expected delivery within 24 Hours