Java Assognment ArrayListADT UnorderedArrayList - 41751

Solution Posted by


Rating : (19)A+
Solution Detail
Price: $20.00
Request Description

Please download from the assignment fold in Blackboard first. After unzipping, you will find two subfolders: Problem7-1 and Problem7-2. Those folders include,, and, which will be used to complete the following problems.

Problem 7.1

In method removeAt, which is inherited from the class ArrayListClass, of the class UnorderedArryList removes an element from the list by shifting the elements of the list. However, if the element to be removed is at the beginning of the list and the list is fairly large, it could take a lot of computer time.

Because the list elements are in no particular order, you could simply remove the element by copying the last element of the list at the position of the item to be removed and reduce the length of list. Based on this idea, please do

(a) Redefine the method removeAt, in the class UnorderedArrayList, using this technique.

(b) Write a program to test your method.

Problem 7.2

The method remove of the class ArrayList Class removes the first occurrence of an element. Please do:

(a) Add the method removeAll to the class ArrayListClass as an abstract method that would remove all occurrences of a given element.

(b) Write the definition of the method removeAll in the class unorderedArrayList,


(c) Write a program to test this method. (Note that you must add the method removeAll in the interfaceADT) 

Solution Description

Java As