Class RosenNumberPartitionIterator

  • All Implemented Interfaces:
    Iterator<int[]>

    public class RosenNumberPartitionIterator
    extends Object
    implements Iterator<int[]>
    An iterator that generates all partitions of n elements, into k parts containing the number of elements in each part, based on Rosen's algorithm.

    This is a copy of the class (with slight edits) with the same name from the Symja Library. The original file was published under the terms of the GPLV3 license, but the Hipparchus project was explicitly allowed to include it relicensed to Apache V2.

    See Kenneth H. Rosen, Discrete Mathematics and Its Applications, 2nd edition (NY: McGraw-Hill, 1991), pp. 284-286

    • Constructor Detail

      • RosenNumberPartitionIterator

        public RosenNumberPartitionIterator​(int n,
                                            int k)
        Simple constructor.
        Parameters:
        n - the number of elements
        k - divided into k parts