intersect, shown below, returns the number of elements that are in both lists. Assume both lists contain N items. a. What is the running time of intersect when both lists are ArrayLists?  b. What is...


intersect, shown below, returns the number of elements that are in both lists. Assume both lists contain N items.


a. What is the running time of intersect when both lists are ArrayLists?


 b. What is the running time of intersect when both lists are LinkedLists?


c. Suppose it takes 4 seconds to run intersect on two equally-sized 1,000-item LinkedLists. How long will it take to run intersect on two equally-sized 3,000-item LinkedLists?


 d. Does rewriting the two loops using the enhanced for loop (i.e. for( int x : c1 ) ) make intersect more efficient? Provide an explanation of your reasoning.



Dec 07, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here