The following routine removes the first half of the list passed as a parameter:public
Chapter 3, Problem 3.8(choose chapter or problem)
The following routine removes the first half of the list passed as a parameter:public static void removeFirstHalf( List> lst ){int theSize = lst.size( ) / 2;for( int i = 0; i < theSize; i++ )lst.remove( 0 );}a. Why is theSize saved prior to entering the for loop?b. What is the running time of removeFirstHalf if lst is an ArrayList?c. What is the running time of removeFirstHalf if lst is a LinkedList?d. Does using an iterator make removeHalf faster for either type of List?
Unfortunately, we don't have that question answered yet. But you can get it answered in just 5 hours by Logging in or Becoming a subscriber.
Becoming a subscriber
Or look for another answer