Date: Thu, 28 Oct 1999 14:03:02 > On the following constructor: > > Set (int* iarray, int numElems) > > if the array contains duplicate elements will that be accounted for in the variable numElems. > > Example: > > iarray = {1, 2, 3, 2, 1} > > Would numElems=5 or would it equal 3? > > numElems would be 5. It is the number of elements in the array, not the number of unique elements. Of course, the set constructed from this array would only have 3 members.
Date: Tue, 26 Oct 1999 13:25:01 > I have been using the -> operator to access members > of functions and data members. What is the difference between -> and > the . operator? Can they be used interchangeably? > . is used in between the name of an object and the name of a class member. -> is used in between a pointer to an object and the name of a class member. They are definitely NOT interchangeable.
Date: Tue, 26 Oct 1999 13:23:00 > In Set.H, one constructor makes a Set that contains elements > in an array that is passed to the constructor. It says that if the array > has any duplicate elements, they are ignored. Does this mean that > duplicate elements should be prevented from going into the new Set, or > that the new Set can have the duplicates in it? > The constructor should prevent duplicate elements from going into the new set.
Date: Tue, 26 Oct 1999 08:54:46 > Question about sets. When finding subsets and equality of two sets, > is sequence an issue? For instance, > > I would expect that the following would be true: > { 1, 2, 3 } = { 1, 2, 3 } > > But is this true? > { 1, 2, 3 } = { 3, 1, 2 } > Both of these are true, and sequence is not an issue. Sets are unordered collections. On the project, I have asked that the members of the set be displayed in ascending order, but this does not change the conceptual view of the set as an unordered collection. In addition, there is no way to request the "nth" element of the set, which is an operation we would expect with an ordered collection. > One in the same, the left set would be a subset of the right set: > { 1, 2, 3 } --> { 8, 1, 2, 3, 4, 5 } > > But would this be true? > { 1, 2, 3 } --> { 1, 3, 2, 8, 4, 5 } > Of course. > Which binary operators would you like us to overload? > I'm assuming these: > +,-,<< > I have not asked you to overload any operators other than = and ==. > Do you want us to implement the Intersection of two Sets with an > operator or a function or at all? This should be clear if you look at Set.H. Union, intersection, and set difference are to be implemented as (non-operator) friend functions.