Derangements, bell permutations, involutions and more

The last few days I have been implementing mostly generic iterables algorithms to generate various combinatorial objects such as Bell permutations, involutions and derangements, cyclic permutations and up-and-down permutations. As I have mentioned before, this goes more into the exercises portion of TAOCP. This is why the algorithms implemented for these routines are not the … Continue reading

Week 3

This week I continued with my work on partitions. The multiset algorithm I had implemented earlier had bugs involving overgeneration and generating incorrect output for some cases. Those were fixed by adding a cache, although the problem of overgeneration remained. That can be fixed to an extent by sorting in the canonical order before we … Continue reading

Week 2

The last week I worked mainly on subsets, gray codes and partitions. Most of the functionality for subsets and gray codes is complete and a lot of progress has been made on the partitions front as well. Since last week Chris Smith updated the integer partition algorithm to include compositions as well. So apart from … Continue reading