Abstract

In this paper we give a simple algorithm to generate all partitions of {1, 2, ..., n} into k non-empty subsets. The number of such partitions is known as the Stirling number of the second kind. The algorithm generates each partition in constant time without repetition. By choosing k = 1, 2, ..., n we can also generate all partitions of {1, 2, ..., n} into subsets. The number of such partitions is known as the Bell number.

Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call