This page was last updated March 4, 2005
Sets
A Set is an unordered collection of distinct values (items or components)
chosed from the domain of possible values. The domain is called the Component
or base type.
Examples:
- Set of integers: (1, 16, 3, 84, 5, 23)
- Set of geometric shapes: (triangle, hexagon, pentagon, rectangle)
- Set of subclasses of cShape: (cTriangle, cHexagon, cPentagon, cRectangle)
Definitions
Subset -- A set X is a subset of set Y if each item in X is also in Y.
Universal Set -- The set containing all the values of the component type. For example:
All integers from negative infinity to positive infinity is the Universal Set of integers.
Empty Set -- A set with no members.
Cardinality -- The number of items in a set.
Union -- A binary set operation that returns a set made up of all the items that are in
either of the input sets.

Intersection -- A binary set operation that returns a set made up of all the items that are in
both of the input sets.

Difference -- A binary set operation that returns a set made up of all the items that are in
the first set but not in the second set.

Symmetric Difference -- A binary set operation that returns a set made up of all the items that are in
the first set or the second set but not in both sets, i.e. the inverse of the Intersection.

See the Code Vault for programming examples of sets.