Question: Please answer all the following Bonus Question For the implementation of List class by fixed size array approach, please write codes for the member function:

Please answer all the following

Please answer all the following Bonus Question For the implementation of Listclass by fixed size array approach, please write codes for the member

Bonus Question For the implementation of List class by fixed size array approach, please write codes for the member function: merge (marked red in the class declaration). public boolean merge(List newlist) which takes a list as an input will add the newList right after the present list. (You need to check if the DEFAULT_CAPACITY of array is big enough to insert the new list. If it is, true is returned, otherwise false is returned). An Example looks like: Input: List newList; Return: true(success)/false(failed) 0 1 2 3 4 index: Present List 5 15 35 25 55 0 1 2 3 index: newList 10 20 50 30 ... 5 6 7 8 After merging, the present list becomes index: 0 1 2 3 4 Present 5 15 35 25 55 List 10 20 50 30 ... The class List is defined as follows: public class List private final items private int size; // number of items in the list private static final int DEFAULT CAPACITY-20; //Default constructor public List() ! //DONE // To check if the list is empty or not public boolean isEmpty() return sice; // To get the length of the list public int gelangth() return size; // To Insert the newItem into the list at position Index //NOTE: @c-indexcelength public boolean insert(int index, Totem) //DONE // To remove an item from the list at position index //NOTE: @cindex.cgetlength() public boolean removint Index) ) // To retrieve a list item by position index // If c-indexegetLength) return the item, otherwise return null. public T retrieve(int index) //DONE // To add the newList right after the current list public boolean arge(List

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!