Thread: union of two sets

  1. #1
    Registered User axon's Avatar
    Join Date
    Feb 2003
    Posts
    2,572

    union of two sets

    as parts of that set assignmnet I have been posting for a few days now I have two have a union, intersection, and difference operations.

    My professor told us we have to use bit-vector representation in order to meet the run time requirements. I'm not exactly sure what he meant by the bit-vector thing. Should I make an operator do the union for me...ie + for union, * for interection, and - for difference. Thats what I found looking around on the internet...but we have not learned anything like that in class....any suggestions?

    some entropy with that sink? entropysink.com

    there are two cardinal sins from which all others spring: Impatience and Laziness. - franz kafka

  2. #2
    Registered User The Dog's Avatar
    Join Date
    May 2002
    Location
    Cape Town
    Posts
    788
    What your professor wants you to use is probably an STL vector of bits. Because there is no bit type, you'll have to use a vector of bool instead.

    I think there's a bitset class. (it's not an STL class)
    There's also a vector<bool> specialization of the STL vector.

    >> should I make an operator do the union for me...ie + for union, * for interection, and - for difference.

    I don't think that's necessary unless your professor said that you must use operator overloading.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem aligning floating point numbers
    By esbo in forum C Programming
    Replies: 4
    Last Post: 01-05-2009, 08:09 PM
  2. union of two sets
    By shuaib.akram in forum C Programming
    Replies: 3
    Last Post: 09-22-2007, 01:36 PM
  3. Replies: 16
    Last Post: 10-29-2006, 05:04 AM
  4. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  5. Sorting a Union
    By andy in forum C Programming
    Replies: 4
    Last Post: 11-21-2001, 10:12 AM