Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA 2. Dynamic Array (16 points) The current version of the dynamic array in this class only increases its size if needed. Now we want

JAVA

image text in transcribedimage text in transcribed

2. Dynamic Array (16 points) The current version of the dynamic array in this class only increases its size if needed. Now we want the dynamic array also to shrink its size if the array does not have many elements. More specifically, we want the dynamic array to shrink its capacity to half if it is only 1/3 full and its capacity is greater than 1000. For example, if the dynamic array has a capacity of 1000, and the dynamic array is empty, then the dynamic array does not shrink because its capacity is not greater than 1000. If a dynamic array has a capacity of 2000, and the array has 666 elements, then the dynamic array should shrink its capacity to 1000. The original remove method is: String remove(int index) { // assume index is valid String removeValue = this.array[index]; for (int i = index; i

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Find the value of the sum.

Answered: 1 week ago

Question

Why do HCMSs exist? Do they change over time?

Answered: 1 week ago