Question: Design an algorithm for an application-level method compare that accepts two String lists as arguments and returns an int representing a count of the number

Design an algorithm for an application-level method compare that accepts two String lists as arguments and returns an int representing a count of the number of elements from the first list that are also on the second list. The signature for the method should be: int compare(ListInterface list1, ListInterface list2) 1. Devise a test plan for your algorithm. 2. Implement and test your algorithm. For this problem, you can write the ListCompare class which contains the compare method, then in the main method, simply run some examples to demonstrate your algorithm works properly with list1 and list2.

Step by Step Solution

3.35 Rating (158 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

here is the algorithm for the compare method def comparelist1 list2 Compares two lists and returns t... View full answer

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 Programming Questions!