Compare Lists

The purpose of these problems is to use loops, logic, and indexes to compare lists. The basic problem is constructing the order and types of comparisons. (We are not looking for the perfect, most efficient algorithm. We are looking for good enough.)

Project #1

Create two list of random integers. Find which values appear in one list but not the other.

Step #1:

Generate two random lists (A and B).

Step #2:

Compare the lists (A and B). Find the differences and the matches. When two values match they are no longer considered in further comparisons.

Step #3:

Display the differences for each list (A and B) and other statistics. Also display matches?

Design/Coding/Testing Hints:

  1. Sort the lists before comparing them.
  2. For each input list, create a list of differences? Or mark each value that has a match? Or mark each value that has no match?
  3. for development create "hand made" small lists (10+)? for testing.

Project #2

Generate 4 lists. Display statistics, including the number of times values appears in the lists. Ignore a value if it appears in all of the lists.

Project#3

Can project #1 be done using sets?

Display performance statistics comparing sets to project #1.