Thread: subsets

  1. #1
    Registered User
    Join Date
    Feb 2003
    Posts
    60

    subsets

    what does it mean to find a subset of a set. for example the subsets of the set {1,2,...,n}.
    I am not asking for a solution but rather what a subset would be.

    Thanks
    C++ can hurt.

  2. #2
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    Assume the set {1,2,3,4,5}

    A subset of a set is a new set, with items that only exists in that set (and no multiples of them, if I remember correctly).

    Example:
    {1,2,3} - Valid, 1,2 & 3 is in the set.
    {5,3} - Valid, same reason
    {3,4,5,6} - Not valid, 6 is not part of the set.
    {1,2,3,4,5} - Valid, however it is not a true subset since it is the exact same as the set.
    {} - Valid? I believe the empty set is considered a subset, not sure though...
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  3. #3
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    A subset is just a set, whose elements are also members of the superset.
    Code:
    A is a subset of B, if all members of A are also in B
    gg

  4. #4
    Registered User
    Join Date
    Feb 2003
    Posts
    60
    thanks a lot
    C++ can hurt.

  5. #5
    Anti-Poster
    Join Date
    Feb 2002
    Posts
    1,401
    Originally posted by Magos
    <snip>
    {1,2,3,4,5} - Valid, however it is not a true subset since it is the exact same as the set.
    {} - Valid? I believe the empty set is considered a subset, not sure though...
    True subset? What is this you speak of? Is 'true subset' a common mathematically defined term? From what I remember, a set A is a subset of B iff A Union B = B, or every element in A is an element of B. From that, it's pretty easy to see that the empty set is a subset of every set.
    If I did your homework for you, then you might pass your class without learning how to write a program like this. Then you might graduate and get your degree without learning how to write a program like this. You might become a professional programmer without knowing how to write a program like this. Someday you might work on a project with me without knowing how to write a program like this. Then I would have to do you serious bodily harm. - Jack Klein

  6. #6
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    Originally posted by pianorain
    True subset? What is this you speak of? Is 'true subset' a common mathematically defined term? From what I remember, a set A is a subset of B iff A Union B = B, or every element in A is an element of B. From that, it's pretty easy to see that the empty set is a subset of every set.
    I don't know if 'true subset' is the correct mathematical term (I'm not english u know ). However, a subset is a 'true subset' if it really is a subset and not the same as the set. In any case, it is a subset, not neccessarily a true subset.

    (If some swede is out here, what is the correct translation of äkta delmängd?)
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  7. #7
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    The terminology I grew up with is proper subset.
    If A is a subset of B, and B contains any elements that are not in A, then A is a proper subset.
    For example A = {1,2} B = {1,2}
    A is a subset of B, A is not a proper subset of B (or vica-versa).

    gg

  8. #8
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    Originally posted by Codeplug
    The terminology I grew up with is proper subset.
    For example A = {1,2} B = {1,2}
    A is a subset of B, A is not a proper subset of B (or vica-versa).

    gg
    Exactly what I meant. Proper subset, thanks!
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. subsets filling the gaps question..
    By transgalactic2 in forum C Programming
    Replies: 0
    Last Post: 07-06-2009, 04:51 AM
  2. How to do array subsets?
    By gormster in forum C Programming
    Replies: 5
    Last Post: 11-14-2007, 06:50 AM
  3. Find all possible subset of a given set
    By Downnin in forum C++ Programming
    Replies: 7
    Last Post: 11-09-2005, 02:03 PM
  4. Subsets of binary string
    By damonbrinkley in forum C Programming
    Replies: 4
    Last Post: 05-03-2005, 09:00 AM
  5. compute the subsets of a set
    By k_w_s_t_a_s in forum C Programming
    Replies: 4
    Last Post: 06-01-2003, 05:54 PM