Created
March 18, 2010 21:38
-
-
Save nazgob/336927 to your computer and use it in GitHub Desktop.
Stirling number of the second kind
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
size_t S(size_t n, size_t k) | |
{ | |
if(k > n) | |
{ | |
return 0; | |
} | |
else if(k == 1) | |
{ | |
return 1; | |
} | |
else | |
{ | |
return S(n-1, k-1) + k * S(n-1, k); | |
} | |
} | |
int main() | |
{ | |
std::cout << S(6,4) << std::endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment