Documentation of 'org.matheclipse.combinatoric.RosenIterator' Java class
RosenIterator
org.matheclipse.combinatoric

Class RosenIterator

  • All Implemented Interfaces:
    java.util.Iterator<int[]>
    Direct Known Subclasses:
    RosenNumberPartitionIterator


    public class RosenIterator
    extends java.lang.Object
    implements java.util.Iterator<int[]>

    An iterator that generates combinations of n elements, C(n), in lexicographic order, based on Rosen's algorithm.

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

      Nested Classes 
      Modifier and Type Class and Description
      static class  RosenIterator.Factory 
    • Constructor Summary

      Constructors 
      Constructor and Description
      RosenIterator(int n, int k) 
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      static long count(int n, int k)
      Computes the number of unique combinations of n elements taken k at a time, which can be computed as: n! / k! (n - k)!
      boolean hasNext()
      int[] next()
      void remove() 
      void reset() 
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.Iterator

        forEachRemaining
    • Constructor Detail

      • RosenIterator

        public RosenIterator(int n,
                             int k)
        Parameters:
        n - the number of elements
        k - taken k at a time
    • Method Detail

      • reset

        public void reset()
      • count

        public static long count(int n,
                                 int k)
        Computes the number of unique combinations of n elements taken k at a time, which can be computed as: n! / k! (n - k)!
        Parameters:
        n - the number of elements
        k - subset/sample size
        Returns:
        the number of combinations of n elements taken k at a time
      • hasNext

        public final boolean hasNext()
        Specified by:
        hasNext in interface java.util.Iterator<int[]>
        See Also:
        Iterator.hasNext()
      • next

        public int[] next()
        Specified by:
        next in interface java.util.Iterator<int[]>
        See Also:
        Iterator.next()
      • remove

        public void remove()
        Specified by:
        remove in interface java.util.Iterator<int[]>

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.