Programmer Question
I'm working on a research problem out of curiosity and I don't know how to program the logic that I've in mind. Let me explain it to you :
I've 4 vectors say for example,
v1 = 1 1 1 1
v2 = 2 2 2 2
v3 = 3 3 3 3
v4 = 4 4 4 4
Now what I want to do is to add them combination-wise. i.e
v12 = v1+v2
v13 = v1+v3
v14 = v1+v4
v23 = v2+v3
v24 = v2+v4
v34 = v3+v4
Till this step it is just fine. The problem is now I want to add each of these vectors one vector from v1,v2,v3,v4 which it hasn't added before. For example
v3 and v4 hasn't been added to v12 so I want to create v123 and v124. similarly for all the vectors like,
v12 should become :
v123 = v12+v3
v124 = v12+v4
v13 should become :
v132 // this should not occur because I already have v123
v134
v14 should become :
v142 // cannot occur because I've v124 already
v143 // cannot occur
v231 // cannot occur
v234 ... and so on.
It is important that I do not do all at one step at the start like for example I can do (4 choose 3) 4C3 and finish it off but I want to do it step by step at each iteration.
Can anybody have any idea how to program this ?
P.S. I'm trying to work on an modified version of apriori algorithm in Databases. I selected C++ and vector tags because I'm trying to do this in C++.
Find the answer here
No comments:
Post a Comment