|Modifier and Type||Method and Description|
Returns the Stirling number of the second kind, "
public static long stirlingS2(int n, int k) throws NotPositiveException, NumberIsTooLargeException, MathArithmeticException
S(n,k)", the number of ways of partitioning an
n-element set into
The preconditions are
0 <= k <= n (otherwise
NotPositiveException is thrown)
n- the size of the set
k- the number of non-empty subsets
k < 0.
k > n.
MathArithmeticException- if some overflow happens, typically for n exceeding 25 and k between 20 and n-2 (S(n,n-1) is handled specifically and does not overflow)
Copyright © 2003–2021 The Apache Software Foundation. All rights reserved.