in reply to algorithm for 'best subsets'
I'm a bit curious where this data is coming from.use Math::Combinatorics; my $nwordsatonce = 4; my ($k,$v); my %totals = (); local $" = ' '; # just in case while (($k,$v) = each %items) { next unless $nwordsatonce <= @$v; my @words = sort @$v; do {$totals{"@$_"} += 1;} for combine($nwordsatonce,@words); } my @comb = sort {$totals{$b} <=> $totals{$a}} keys %totals; print "Top $nwordsatonce - word combinations:\n"; do {print "$_\n";} for @comb[0..4];
-- @/=map{[/./g]}qw/.h_nJ Xapou cets krht ele_ r_ra/; map{y/X_/\n /;print}map{pop@$_}@/for@/
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: algorithm for 'best subsets'
by fizbin (Chaplain) on Mar 03, 2005 at 19:50 UTC |