Question: / * Grows a to double its current size if newSize exceeds a ' s capacity. Does * nothing if newSize < a . length.

/* Grows a to double its current size if newSize exceeds a's capacity. Does
* nothing if newSize < a.length. Grow the array by allocating a new array
* and copying the old array's contents into the new one. This does *not*
* change the AList's size. */
protected void growIfNeeded(int newSize){
// TODO 2a
}
/** Resizes the AList.
* this *does* modify the size, and may modify the capacity if newsize
* exceeds capacity. */
public void resize(int newsize){
// TODO 2b
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!