This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
notes:discrete:fall2023:projects:set0 [2023/11/07 02:36] – [intersection] mfee1 | notes:discrete:fall2023:projects:set0 [2023/11/09 04:45] (current) – [member] cfoster8 | ||
---|---|---|---|
Line 5: | Line 5: | ||
====member==== | ====member==== | ||
+ | A member is an element within a set. Each member within a set is unique from each other (no duplicates). | ||
+ | |||
+ | There also cannot be more members in the set than there is space in the array. It only has as much memory allocated as the array specifies. To make the set larger you would need to make a new array. | ||
====Venn Diagram==== | ====Venn Diagram==== | ||
Line 10: | Line 13: | ||
====set==== | ====set==== | ||
- | ====universe==== | + | A set is a group of unique objects, typically ordered in some way or another. Sets are typically used to test membership of a given value rather than retrieving a specific element. Sets (at least for us) will typically be stored in Arrays, however they can be stored in a List. |
+ | For example if you want an occurrence to only happen if a specific value is one of 5 different items, you could compare it against a set. Your code can then branch off whether there is a match or not. | ||
+ | ====universe==== | ||
+ | A Universe or a Universal set has all components of all sets within it. It is typically written as U. An example: if A{1,2,3} and B{a,b,c} then U{1, | ||
=====Set Logic===== | =====Set Logic===== | ||
Line 20: | Line 26: | ||
The intersection of Sets is defined as the set of common elements of all the sets. This operation can be thought of as being equivalent to the logical AND operator. | The intersection of Sets is defined as the set of common elements of all the sets. This operation can be thought of as being equivalent to the logical AND operator. | ||
====complement==== | ====complement==== | ||
+ | The complement of a set is the difference of a set and the Universal set. Mathematically is can be seen as U{1,2,3,a} - A{2,3} = A' | ||
====difference==== | ====difference==== | ||
+ | The difference of two sets is when one set has its elements subtracted from the other. This means there is a directionality to it, so sets '' | ||
+ | |||
+ | Say we have the sets '' | ||
====disjoint / mutually exclusive=== | ====disjoint / mutually exclusive=== | ||
===What is disjoint=== | ===What is disjoint=== |