Question: ramming Questions (50 marks): In these programming questions you will evaluate two implementations of List interface in terms of their performance for different operation List

 ramming Questions (50 marks): In these programming questions you will evaluatetwo implementations of List interface in terms of their performance for different

ramming Questions (50 marks): In these programming questions you will evaluate two implementations of List interface in terms of their performance for different operation List interface is an ordered collection (also known as a sequence). The user of this interface has precise control over where in the list each element is inserted. The user can access elements by their integer index (position in the list), and search for elements in the list The List interface provides four methods for index access to list elements, two methods to search for a specific object, and two methods to efficiently insert and remove multiple elements at an arbitrary location in the list. Note that the speed of these operations may depend on the implementation (e.g. Array or LinkedList) You are required to write two implementations of List interface, onc that uses array, and one that uses doubly-linked list. Then, you will have to test the performance of several operations when using your implementations Question 1: Implement the following methods in the two implementations (called MyArraylist and MyLinkedList) of List interface !Appends the specified element to the end of this list Boolea add(E e) void add (int index, E element) #1nserts 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 Returns a string representation of this list /Retums 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 bchavior 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 it 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. ist.add(randomLocation, number)). https://docs.oracle.com/javase 7 docs/api/java/util/List.html 2https:/docs.oracle.com/javase/7/docs/api/java/util/LinkedList.html https://docs.oracle.com Javase 8/docs api/java util/ ArrayList.html COMP352-Fall 2018 Assignment 2 Page 3 of 5 ramming Questions (50 marks): In these programming questions you will evaluate two implementations of List interface in terms of their performance for different operation List interface is an ordered collection (also known as a sequence). The user of this interface has precise control over where in the list each element is inserted. The user can access elements by their integer index (position in the list), and search for elements in the list The List interface provides four methods for index access to list elements, two methods to search for a specific object, and two methods to efficiently insert and remove multiple elements at an arbitrary location in the list. Note that the speed of these operations may depend on the implementation (e.g. Array or LinkedList) You are required to write two implementations of List interface, onc that uses array, and one that uses doubly-linked list. Then, you will have to test the performance of several operations when using your implementations Question 1: Implement the following methods in the two implementations (called MyArraylist and MyLinkedList) of List interface !Appends the specified element to the end of this list Boolea add(E e) void add (int index, E element) #1nserts 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 Returns a string representation of this list /Retums 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 bchavior 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 it 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. ist.add(randomLocation, number)). https://docs.oracle.com/javase 7 docs/api/java/util/List.html 2https:/docs.oracle.com/javase/7/docs/api/java/util/LinkedList.html https://docs.oracle.com Javase 8/docs api/java util/ ArrayList.html COMP352-Fall 2018 Assignment 2 Page 3 of 5

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!