G
gamo
I want to learn an effient way of handle circular lists.
EXAMPLE:
I have a set of @set = qw(a a b b b c c c c);
In a loop...
@list = shuffle(@set);
and I want to know how many diferent circular lists could be generated.
Thanks, best regards
PS: The way I handle this is doing
$s = join '',@list;
$string = $s . $s;
and after that comparing $s with all the previous stored substr
$string,$i,9 for $i (0..9)
BUT this way is very inefficient for a large @set or long loop.
EXAMPLE:
I have a set of @set = qw(a a b b b c c c c);
In a loop...
@list = shuffle(@set);
and I want to know how many diferent circular lists could be generated.
Thanks, best regards
PS: The way I handle this is doing
$s = join '',@list;
$string = $s . $s;
and after that comparing $s with all the previous stored substr
$string,$i,9 for $i (0..9)
BUT this way is very inefficient for a large @set or long loop.