Suppose linkedlist extends abtractcollection and does not


Question: Consider the following implementation of the removeAll method (which removes all occurrences of any item in the collection passed as a parameter from this collection).

887_6.png

a. Suppose LinkedList extends AbtractCollection and does not override removeAll. What is the running time of removeAll when c is a List?

b. Suppose LinkedList extends AbstractCollection and does not override removeAll. What is the running time of removeAll when c is a TreeSet?

c. Suppose ArrayList extends AbstractCollection and does not override removeAll. What is the running time of removeAll when c is a List?

d. Suppose ArrayList extends AbstractCollection and does not override removeAll. What is the running time of removeAll when c is a TreeSet?

e. What is the result of calling c.removeAll(c) using the implementation above?

f. Explain how to add code so that a call such as c.removeAll(c) clears the collection.

Solution Preview :

Prepared by a verified Expert
Data Structure & Algorithms: Suppose linkedlist extends abtractcollection and does not
Reference No:- TGS02457665

Now Priced at $15 (50% Discount)

Recommended (93%)

Rated (4.5/5)