public class RosenNumberPartitionIterator extends Object implements Iterator<int[]>
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 and Description |
---|
RosenNumberPartitionIterator(int n,
int k) |
Modifier and Type | Method and Description |
---|---|
boolean |
hasNext() |
int[] |
next() |
void |
reset()
Reset this iterator to the start condition.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEachRemaining, remove
public RosenNumberPartitionIterator(int n, int k)
n
- the number of elementsk
- divided into k partspublic final boolean hasNext()
hasNext
in interface Iterator<int[]>
Iterator.hasNext()
public final int[] next()
next
in interface Iterator<int[]>
Iterator.next()
public void reset()
Copyright © 2016-2022 CS GROUP. All rights reserved.