This website is preserved for historical and scholarly reference and is no longer actively maintained.
                         CpSc 241, Section 1
                             Assignment 7
                             8 March 2000


Due: Wednesday, March 15 at midnight

Late penalties: 20 points per partial day late.  That is, programs
	turned in after midnight Wednesday and before midnight Thursday
	will have 20 points deducted for late, programs turned in after
	midnight Thursday and before midnight Friday will have a total
	of 40 points deducted for late, etc.

Total point value of assignment:  100 points

Late submissions not accepted after: Sunday, March 19 at midnight

This assignment is to be done INDIVIDUALLY.



Create a directory, A7, which will contain all parts of this assignment.
You will need a class for lists.  You should decide what you need.
  

The objectives of this program are to give you experience processing
usual set operations.  (Since the Disjoint Set ADT works only for
disjoint sets, that data structure cannot be used here.)


The main() will be called a7.cc or a7.cpp, whichever you choose.  Submit
all files in directory A7 using handin.


Input:

	Using cout and cin, request the user to enter a non-negative integer,
	num, between 0 and 10, inclusive.  This number will be the
    count of the number of items in the first set.  Then request
    the user to enter (one by one) this number of integers and
    store them in the first list.

	Now, ask the user to enter a second non-negative integer between
    0 and 10.  This number will be the count of the number of items in
    the second set.  Request the user to enter this number of integers.


Output:

	Before reading the input, print your name, the assignment number,
	and a short description of the assignment to the screen.
    

Other requirements:

    Design a class Set with operations unionSets, intersectSets,
    addElementToSet, printSet, makeEmpty, and find.  The method find
    should have the form:

        int DisjSets::find ( int x ) const
        // pre:  The set exists, but may be empty
        // post:  If x is not in the set, -1 is returned. 
        //        Otherwise, a predetermined representative of the set
        //        is returned (as, for example, the first element in
        //        the list representing the set).

    Design your own test program and run it.  Be sure to test:
 
        both sets empty
        exactly one set empty (two cases: first empty, second empty)
        first set a subset of second set
        second set a subset of first set
        identical sets
        sets not equal and non-empty intersection

*****    PLEASE NOTE:
*****    The set intersection and set union methods are required to
*****    execute in O(N) time.  O(N**2) methods will not receive credit.
  
	Follow the style standards to be found from your instructor's
	web page for CPSC 241.


Grading rubric:


	In the opinion of the instructor the program is an honest attempt
		to complete the assignment as described  10 pts.

	If the above requirement is met:
		Required documentation and style standards 20 pts.

	If the two previous requirements are not met or the program does
    not compile, no further points will be awarded.

    Set operations 60 pts.  60 pts. (10 pts. each )
    Quality of test program 10 pts.
    Quality of test program 10 pts.
<.BODY>