User Tools

Site Tools


Sidebar

projects

wcp1 (due 20240828)
btt0 (due 20240904)
wcp2 (due 20240904)
pct0 (bonus; due 20240905)
pct1 (bonus; due 20240905)
pct2 (due 20240905)
abc0 (due 20240906)
msi0 (due 20240911)
pct3 (bonus; due 20240911)
wcp3 (due 20240911)
msi1 (due 20240918)
pct4 (due 20240918)
wcp4 (due 20240918)
dsr0 (due 20240926)
pct5 (bonus; due 20240926)
wcp5 (due 20240926)
gfo0 (due 20241002)
pct6 (due 20241002)
pnc0 (due 20241002)
wcp6 (due 20241002)
dsr1 (due 20241009)
pct7 (bonus; due 20241009)
wcp7 (due 20241009)
bwp1 (bonus; due 20241016)
pct8 (due 20241016)
pnc1 (due 20241016)
wcp8 (due 20241016)
pct9 (bonus; due 20241023)
pnc2 (due 20241023)
wcp9 (due 20241023)
gfo1 (due 20241030)
mag0 (due 20241030)
pctA (due 20241030)
wcpA (due 20241030)
mag1 (due 20241106)
pctB (bonus; due 20241106)
wcpB (due 20241106)
mag2 (due 20241113)
pctC (due 20241113)
wcpC (due 20241113)
pctD (bonus; due 20241120)
wcpD (bonus; due 20241120)
bwp2 (bonus; due 20241204)
gfo2 (due 20241204)
pctE (bonus; due 20241204)
wcpE (bonus; due 20241204)
EoCE (due 20241216)
haas:fall2024:discrete:projects:set0

Corning Community College

CSCS2330 Discrete Structures

PROJECT: Sets Explored Topic (SET0)

OBJECTIVE

Implement a visual set logic program that demonstrates the basic set operations in some way.

EDIT

You will want to go here to edit and fill in the various sections of the document:

SET0

Terms

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

a Venn Diagram is a diagram style that shows the logical relation between sets. This diagram is composed of circles with the values of each set inside their own circles. This allows a value from a set to be present in more than one circle. For example, we can have one circle containing animals that can fly, and one circle containing animals with two legs. Animals with both, two legs, and can fly, will be presented in the overlapping section of the circles while animals with only one of those qualities will be present in only one circle.

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

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

union

The union of sets is an operation that combines two or more sets to create a new set that contains all the unique elements from the input sets. In other words, the union of sets A and B, denoted by A ∪ B, is a union of sets A and B includes all elements that are present in either A or B, without duplicating any elements. If an element appears in both sets A and B, it is included in the union only once. You can extend this concept to the union of more than two sets. The union of three or more sets, such as A ∪ B ∪ C, includes all elements that are present in any of the three sets. The union operation is commutative, meaning that the order of the sets does not matter; A ∪ B is the same as B ∪ A.

intersection

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. If set A = { 1, 3, 5, 8, 9 } and set B = { 2, 3, 5, 7, 9 }, the intersection of A and B, written as A ∩ B = { 3, 5, 9 }

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'{1,a}. In a Venn diagram if the Universal set is the whole picture then the complement is the space that is not in the Venn Diagram.

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
What is disjoint

Disjoint in relation to set logic is when you are given two sets that do not share anything in common at all. Here is a simple example. you have a set A that consists of elements 1,2,3,4 and a set B that consists of elements 5,6,7,8. The two sets do not have any of the same elements thus the two sets are disjoint.

Here is also an example of two sets that are not disjoint. you are given set A which consists of 1,2,3,4 and set B which consists of 3,4,5,6. Because the two sets contain some of the same elements the sets are not disjoint.

How to show Disjoint using Venn Diagram

I found that displaying an example of disjoint sets was the easiest out of all the set logic. Instead of having two circles overlapping, you have two circles separated there for the sets are disjoint (not connected/share similar elements).

Simple Function for disjoint

When you are creating your disjoint function use the following as inspiration.

int disjointSets(int *set1, int size1, int *set2, int size2)
{
    // Iterate through set 1
    for (int i = 0; i < size1; i++)
    {
        // Check if the current element of set 1 is in set 2
        for (int j = 0; j < size2; j++)
        {
            if (set1[i] == set2[j])
            {
                return 0; // Not disjoint because the two sets have a common element
            }
        }
    }
    return 1; // Disjoint because the two sets do not have a common element
}
 

SUBMISSION

To be successful in this project, the following criteria (or their equivalent) must be met:

  • Project must be submit on time, by the deadline.
    • Late submissions will lose 33% credit per day, with the submission window closing on the 3rd day following the deadline.
  • Executed programs must display in a manner similar to provided output
    • output formatted, where applicable, must match that of project requirements
  • Processing must be correct based on input given and output requested
  • Output, if applicable, must be correct based on values input
  • Code must be nicely and consistently indented
  • Code must be consistently written, to strive for readability from having a consistent style throughout
  • Code must be commented
    • Any “to be implemented” comments MUST be removed
      • these “to be implemented” comments, if still present at evaluation time, will result in points being deducted.
      • Sufficient comments explaining the point of provided logic MUST be present
  • No global variables (without instructor approval), no goto statements, no calling of main()!
  • Track/version the source code in your lab46 semester repository
  • Submit a copy of your source code to me using the submit tool by the deadline.

Submit Tool Usage

Let's say you have completed work on the project, and are ready to submit, you would do the following:

lab46:~/src/SEMESTER/DESIG/PROJECT$ submit DESIG PROJECT file1 file2 file3 ... fileN

You should get some sort of confirmation indicating successful submission if all went according to plan. If not, check for typos and or locational mismatches.

RUBRIC

I'll be evaluating the project based on the following criteria:

208:set0:final tally of results (208/208)
*:set0:functional program showing operations [104/104]
*:set0:implements and utilizes the set operations [104/104]

Pertaining to the collaborative authoring of project documentation

  • each class member is to participate in the contribution of relevant information and formatting of the documentation
    • minimal member contributions consist of:
      • near the class average edits (a value of at least four productive edits)
      • near the average class content change average (a value of at least 1024 bytes (absolute value of data content change))
      • near the class content contribution average (a value of at least 1kiB)
      • no zero-sum commits (adding in one commit then later removing in its entirety for the sake of satisfying edit requirements)
    • adding and formatting data in an organized fashion, aiming to create an informative and readable document that anyone in the class can reference
    • content contributions will be factored into a documentation coefficient, a value multiplied against your actual project submission to influence the end result:
      • no contributions, co-efficient is 0.50
      • less than minimum contributions is 0.75
      • met minimum contribution threshold is 1.00

Additionally

  • Solutions not abiding by spirit of project will be subject to a 50% overall deduction
  • Solutions not utilizing descriptive why and how comments will be subject to a 25% overall deduction
  • Solutions not utilizing indentation to promote scope and clarity or otherwise maintaining consistency in code style and presentation will be subject to a 25% overall deduction
  • Solutions not organized and easy to read (assume a terminal at least 90 characters wide, 40 characters tall) are subject to a 25% overall deduction
haas/fall2024/discrete/projects/set0.txt · Last modified: 2023/10/29 21:12 by 127.0.0.1