User Tools

Site Tools


notes:discrete:fall2023:projects:set0

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
notes:discrete:fall2023:projects:set0 [2023/11/08 15:24] – [complement] dwhite26notes: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====
  
 +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,2,3,a,b,c}. If you think of a Venn Diagram then a Universal set is the space around the Diagram, it contains all parts of all sets within it +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,2,3,a,b,c}. If you think of a Venn Diagram then a Universal set is the whole Diagram. 
 =====Set Logic===== =====Set Logic=====
  
Line 23: Line 29:
 ====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 ''A-B ≠ B-A''.
 +
 +Say we have the sets ''A={0,1,3,5,7,9}'' and ''B={0,2,3,4,8,9}''. To get the difference of one set from the other, you go through your first set, look at its first term, and check if it exists in the second set. If it does not, the term will exist in the set difference, otherwise it will not. The difference of set A minus set B is ''A-B={1,5,7}'', while the difference of set B minus set A is ''B-A={2,4,8}''
 ====disjoint / mutually exclusive=== ====disjoint / mutually exclusive===
 ===What is disjoint=== ===What is disjoint===
notes/discrete/fall2023/projects/set0.1699457051.txt.gz · Last modified: 2023/11/08 15:24 by dwhite26