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

×

Login

Login or Sign up for access to all of our study tools and educational content!

Forgot password?
Register Now

×

Register

Sign up for access to all content on our site!

Or login if you already have an account

×

Reset password

If you have an active account we’ll send you an e-mail for password recovery

Or login if you have your password back