The class AList has an array that can grow in size as objects are added to the list

Chapter 13, Problem 12

(choose chapter or problem)

The class AList has an array that can grow in size as objects are added to the list. Consider a similar class whose array also can shrink in size as objects are removed from the list. Accomplishing this task will require two new private methods. The first new method checks whether we should reduce the size of the array: private boolean isTooBig() This method returns true if the number of entries in the list is less than half the size of the array and the size of the array is greater than 20. The second new method creates a new array that is three quarters the size of the current array and then copies the objects in the list to the new array: private void reduceArray() Implement each of these two methods for our new class. Then use these methods in the definition of the method remove.

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