in reply to Re: algorithm for 'best subsets'
in thread algorithm for 'best subsets'

Wow. It's certainly interesting code (that's not a backhanded compliment).

However, I think you figured combinations that weren't what the OP was looking for. You tell us what the intersection is of each tuple of keys: for example, b and c have two and five in common. I think what the OP wanted was the intersection of a tuple of values: two and five appear together in b, c, e, g, and h.

If I can figure out what's what in your code, I will see if it can be made to do that. Also, you can use arrays instead of hashes for revipos and revkpos; then you can use @revipos everywhere you use sort keys %items (because that's all it is).


Caution: Contents may have been coded under pressure.