Question: Question 1 Implement the following methods in the two implementations (called MyArrayList and MyLinkedList) of List interface /l Appends the specified element to the end

Question 1 Implement the following methods in the two implementations (called MyArrayList and MyLinkedList) of List interface /l Appends the specified element to the end of this list Boolean add (E e) void add (int index, E element) I/ Inserts the specified element at the specified position in this list void clear () E remove (int index) Boolean remove (Object o) String toString () int size () // Removes all of the elements from this list // Removes the element at the specified position in this list // Removes the first occurrence of the specified element from this list /l Returns a string representation of this list // Returns the number of elements in this list Define your classes to be generics. The array implementation should have dynamic resizing (double the size when growing and halve the size when less than 25 % of the capacity is used); and the linked list implementation should use doubly linked list. Also, the behavior of these methods should be equivalent to that of Java Standard Library's classes ArrayList or LinkedList. Please refer to the corresponding descriptions online. For the rest of the methods of the List interface, you may just throw an exception public type someUnneededMethod) throw new UnsupportedOperationException ) Question 2: Write your driver class ListTester. Use both of your list implementations and compare them to the corresponding Java library implementations (ArrayList and LinkedList) For numbers N 10, 100, 1000, 10000, 100000, 1000000 a) Starting with empty lists of Number-s; measure how long t takes to insert N integer numbers (int, or Integer) with random values ranging from 0 to 2N into the lists, when inserting them at the beginning, at the end, and into a random location of the list (use indices to indicate where to do the insertion (e.g., list.add (randomLocation, number)). b) Starting with non-empty lists of N items (e.g., from part a), measure how long takes to remove N numbers from the lists when removing them from the beginning, from the end, and from a random location of the list (use indices to indicate the location). c Starting with non-empty lists of N items (same as part b), measure how long it takes to remove N random numbers (with values between 0 and 2N) from the four lists (some values might not exist in the list!). Produce the following table (the timing values below are just an illustration and do not relate to any real measurements Insertestart (ms) 15 15 15 15 Inserteend (ms) 201 201 201 201 Insert@random (ms) 603 603 603 603 MyArravList ArrayList MyLinkedList LinkedList N10 MvArrayList ArrayList MyLinkedList LinkedList Remove@start (ms) Remove@end (ms) 201 201 201 201 Remove@random (ms) 603 603 603 603 Remove byvalue (ms) 121212 15 121212 Repeat for all values of N 100; N 1000; ..etc Save the result of your program execution in a file testrun.txt and submit it together with your other
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
