Integer Array Intersection Compound

User avatar
claudevervoort
Posts: 89
Joined: 16 Oct 2009, 02:56
Location: Montréal, QC, Canada

Integer Array Intersection Compound

Post by claudevervoort » 17 May 2011, 04:54

Hi,

In the context of the ICE modeling challenge I came up with a small compound to get the intersection of 2 integer arrays, for example [1,5,7,9] and [2,4,5,7,12] will give [5,7].

You can see the ICE Tree for it in this thread. (Moderator edit - ...or below - HB)

Just beware it will build arrays of the size of the maximum integer value, so might not be the best choice if you want to intersect arrays like [ 12323, 2350924 ] :)

Claude
IntegerArrayIntersect.xsicompound
Image

Moderator edit: I've hidden the URL behind "this thread" and added a direct [img] link to the image... - HB
You do not have the required permissions to view the files attached to this post.

User avatar
Hirazi Blue
Administrator
Posts: 4973
Joined: 04 Jun 2009, 12:15

Re: Integer Array Intersection Compound

Post by Hirazi Blue » 17 May 2011, 10:06

Like I already said in the other thread: very nice compound.
Not only for its intended use, but also to show an approach to the problem
I personally wouldn't have thought of in - oh lets say - a million years.
Great compound & very educational: A+ ;)
...