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/08 16:07] – [difference] walley | notes:discrete:fall2023:projects:set0 [2023/11/09 04:45] (current) – [member] cfoster8 | ||
---|---|---|---|
Line 7: | Line 7: | ||
A member is an element within a set. Each member within a set is unique from each other (no duplicates). | 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 12: | Line 13: | ||
====set==== | ====set==== | ||
- | 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. | + | 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==== | ====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, | 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, | ||
Line 27: | Line 30: | ||
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 '' | 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=== |