Question: The goal of this assignment is to implement a dynamic array for some of the data structures we covered in this course. The size of

The goal of this assignment is to implement a dynamic array for some of the data structures we covered in this course. The size of the array that holds the data structure is static. Thus, when the data structure is full and the user tries to add a new element, an error occurs. Your goal is to grow the array when some space is needed. When inserting a new element and the array is full, we do the following:

1- Allocate a new array temp with a capacity that is twice as large as the original array (for example A).

2- Copy all the elements from the original array to the new array, temp. When copying the elements, you must make sure that the structure is correct. For example, when you copy the heap, the maximum element will stay as the maximum element. For Queue, the front element will not be changed. The index of the front element might need to be changed. For Hash, you must hash the elements when you copy them to the temp array.

3- Make the original array variable points to the new array temp.

You must implement the expand() method in the four classes, ArrayStack, ArrayQueue, HeapPriorityQueue, and LinearProbingHashTable. The expand method is already added to the class and some code is provided. You should complete the implementation.

Make sure the testing code provided in TestingAssignment2.java is working correctly for each testing method: testingStack(), testingQueue(), testingHeapPriorityQueue(), and testingLinearProbingHashTable().

(Codes files)

https://drive.google.com/drive/folders/11CnWkRPokS0aUYaIGpZc2E9gCJB_nzQQ

Please show in what class to add each method in java

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!

Related Book