intersections?

This is a discussion on intersections? within the C Programming forums, part of the General Programming Boards category; ok in math we have unions and intersections. if i have set A={1,2,3} and set B={2,3,4} and i want to ...

  1. #1
    Registered User
    Join Date
    Mar 2004
    Posts
    494

    intersections?

    ok in math we have unions and intersections. if i have set A={1,2,3} and set B={2,3,4} and i want to find the interection, the elements of set A that are also in set B. is there any way i can check for this? like some special function, basically the question is how is intersection defined in the C language? or am I the one that has to define it?
    When no one helps you out. Call google();

  2. #2
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,260
    Intersection is not defined in the C language, so you have to program that logic yourself. Think of your sets as arrays of numbers. Then to find the intersection set, you just need to loop through one of the arrays, checking each values against all the values in the other array. If the value is found in the other array, then you can include it in the intersection set.

  3. #3
    Registered User
    Join Date
    Mar 2004
    Posts
    494
    yep thanks for the tip, didnt think of creating another set that would be the intersection set.
    When no one helps you out. Call google();

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. line-square and circle-square intersections
    By tomast in forum Game Programming
    Replies: 1
    Last Post: 11-16-2008, 08:12 AM
  2. PLEASE!!! help intersections problems
    By inmaterichard in forum C Programming
    Replies: 6
    Last Post: 07-24-2007, 06:14 PM
  3. IDEA: Polygon unions and intersections
    By Magos in forum Contests Board
    Replies: 3
    Last Post: 05-21-2003, 08:16 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21