Last active
September 11, 2016 20:29
-
-
Save Superty/d8a2acf63ca1229f210e41f5bd5ef896 to your computer and use it in GitHub Desktop.
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
dp[i][j] = no. of ways to get j in the first i slots | |
dp[0][j] = 0, dp[0][0] = 1 | |
dp[i][j] = sum[i - 1][b] - sum[(k = a to b) | |
sum[i - 1][j] = sum dp[i - 1][k] k = 1 to j | |
dp[i] | |
dp[i][j] = no. of ways to partition i into j partitions | |
dp[i][j] = dp[i - 1][j - 1] + j*dp[i - 1][j] | |
sum j*dp[i][j] = | |
sum dp[i][j] = sum dp[i - 1][j] (j = 0 to inf) + sum j*dp[i - 1][j] (j = 0 to inf) | |
= sum (j+1) dp[i - 1][j] (j = 0 to inf) | |
paste |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment