Searching for subsets within multidimensional arrays

S

Scott Handojo

Lets say I have the following arrays

X1 (1, 2, 7, 8)
X2 (1, 2, 4, 6)
X3 (1, 2, 3, 5)
X4 (1, 3, 5)
X5 (2, 3, 5)
X6 (4, 5, 6, 8)

My 'search array' is comprised of
S1 (1,2,3,5,7,8)

I want all the arrays with either the same values or a
subset there of. So the result should be that I have the
arrays
X1, X3, X4, X5

X2 is discarded because of the '4' and X6 because of
the '4'

I could go through each array, but that seems slow and
time consuming. Is there a faster way of doing this
within C#?

Thanks,
Scott
 
S

Shakir Hussain

Scott,

I believe there is no direct function in c# for your purpose.

ArrayList.BinarySearch function is available for searching within the same
array. You have to implement your own logic to search between arrays which
has different dimensions.

If speed is the issue, you can paste the code here or you can email to
(e-mail address removed). I will try to optimize it .
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top