Question: How would we write the body for the insert(), deleteAt(), delete(), and the locate() methods? I've tried writing down some code but can't seem to


How would we write the body for the insert(), deleteAt(), delete(), and the locate() methods? I've tried writing down some code but can't seem to get it to work.
* This class provides a growable array for primitive long values. * @author * @version 1.0 1/16/2020 */ class BigIntArrayList { //fields private long[] list; private int count; * Constructor. Initializes the underlying array to 10 elements. */ BigIntArrayList() { list = new long[10]; count = 0; Inserts the given long value at the given index. The index is assumed to be a value between 0 and count. Existing elements are moved up as needed to make room for the new value. * @param index the index where the new value should be stored * @param value the value to be stored */ public void insert(int index, long value) { count = list.length; count++; for (int i = count - 1; i > index; i--) { list[i] = list[i - 1]; list[index] = value; * Deletes the value at the given index. The index is * assumed to be a value between 0 and count - 1. Existing elements are moved down as needed to keep all values contiguous, without any empty spaces in the array. * @param index the index of the element that should be removed * @return the value that was removed */ public long deleteAt (int index) { long[] newList = new long[list.length - 1]; for (int i = 0; i
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
