Generate combinations by order and fixed length.

Posted by roconmachine on Stack Overflow See other posts from Stack Overflow or by roconmachine
Published on 2010-04-28T04:05:47Z Indexed on 2010/04/28 4:13 UTC
Read the original article Hit count: 242

Filed under:

Suppose there is array

main[] = [a,b,c,....z];
a[] = [a1,a2,a3,....] ,
b[] = [b1,b2,b3,....]

and so on.

So if we generate combination in main.length of ordered then it looks like .....
a1 b1 c1, a1 b1 c2, a1 b1 c3 ......
a1 b2 c1, a1 b3 c1, .....
a2 b1 c1, a3 b1 c1, .....

and total count will be a.length * b.length * c.length ........ = ?

So write a code in any language to generate those combination. all the best.

alex

© Stack Overflow or respective owner

Related posts about programming