containsSum, shown below, returns true if there exists two unique numbers in the list that sum to K. Assume N is the size of the list.
a. What is the running time of containsSum when the list is an ArrayList?
b. What is the running time of containsSum when the list is a LinkedList?
c. Suppose it takes 2 seconds to run containsSum on a 1,000-item ArrayList. How long will it take to run containsSum on a 3,000-item ArrayList? You may assume containsSum returns false in both cases.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here