I am looking for a way where I can generated different combination of 4 sets elements in such a manner that every set's element has a fixed place in the final combination: To explain better my requirement let me give sample of those 4 sets and finally what I am looking for:
Set#1(Street Pre Direction) { N, S } Set#2(Street Name) {Frankford, Baily} Set#3(Street Type) {Ave, St} Set#4(Street Post Direction) {S}
Let me list few expecting combinations:
N Baily Ave S
S Frankford St S
S Baily Av S
.
.
.
Now as you can see that every set's element is falling into its place
Pre Direction is in Place 1
Street Name is in Place 2
Streety Type is in Place 3
Street Description is in Place 4
I am looking for the most efficient way to carry out this task, One way to do it is to work at 2 sets at a time like:
Make Combination of Set 1 and Set 2 --> create a new set 5 of resulting combinations
Make Combination of Set 5 and Set 3 --> create a new set 6 of resulting combinations
Make Combination of Set 6 and Set 4 --> This will give me the final combinations
Is there a best way to do this thing? Kindly help. I will prefer C# or Java.
Thanks