Re: Looking for an algorithm to accomplish the following



Hi Fadi

I have some questions. Firstly are the set's as nicely behaved as depicted
below? For your sets, say S1 and S2, you could simply go Sum = S1[I] +
S2[I]. Are the entries to be added always in the same position? or could
it as follows:

Set2: W=5, X=10, Y=10, Z=20
Set3: W=10, X=0, Y=20, Z=10

Now result is W=20, X=15, Y=30, Z=20, because

Result.W = Set2.X + Set3.Y = 20
Result.X = Set2.W + Set3.W = 15
Result.Y = Set2.Z + Set3.Z = 30
Result.Z = Set2.Y + Set3.X

Secondly, if your sets are behaved it seems like your solution is going to
be O(n^2). I guess you could use hashing to cut down on the time, but that
depends on how large your sets are. Are they all 4 elements in size? How
many are there in total? 10 sets? 1000 sets? Also do you only add 2 sets at
a time? Or could we add up set 2, 5 and 7 to get your result?

Let me know and I'll see what I can do. What language are you using? C?



"fadi" <fadi@xxxxxxxxxx> wrote in message
news:ZA5Re.202525$0f.63775@xxxxxxxxxxxxxxxxxxxxxxx
> Hello all,
>
> Lets say there are N number of sets and each set has the same number of
> attributes as follows:
>
> Set1: W=10, X=15, Y=5, Z=25
> Set2: W=10, X=5, Y=10, Z=20
> Set3: W=10, X=10, Y=20, Z=0
> Set4: W=10, X=30, Y=10, Z=5
>
> Now, to find the sets that if summed, you would get the following values:
>
> Result: W= 20, X=15, Y=30, Z=20
>
> Answer would be Set2 + Set3 of course, but is there an algorithm that I
> can follow that would find this answer for me?
>
> It is really more complicated than this where the desired Result can be
> off by certain factor and would have condition as to which can be
> added..etc, but an algorithm would be a starting point for a software I am
> writing hopefully.
>
> Thanks!
>


.



Relevant Pages

  • Re: Search Algorithm
    ... >> same with Hashing Tables and it suits to what I am ... If you need fast search times then why use ... > In this case I would suggest a different language. ... > algorithm itself but rather the language. ...
    (Debian-User)
  • Re: Search Algorithm
    ... > same with Hashing Tables and it suits to what I am ... be using some tree structure if you really want efficient search times. ... In this case I would suggest a different language. ... algorithm itself but rather the language. ...
    (Debian-User)
  • Re: Can one eliminate English (US) from Word?
    ... >> my entries were missing: what is odd is that those AutoCorrect entries I put ... > The formatted ones will contain language formatting as part of their content; ... but some AutoCorrect entries were made. ...
    (microsoft.public.word.customization.menustoolbars)
  • Re: A Fast sorting algorithm for almost sorted data
    ... your example sequences), then you merely need to look up the count for ... probability updating and reordering algorithm is quite simple... ... for posn in seen: ... fast, can handle a practically limitless number of entries, and is able ...
    (comp.compression)
  • Re: Autocorrect
    ... AutoCorrect entries are stored in .acl files by language. ...
    (microsoft.public.word.docmanagement)