摘要:
采用给出的 n 种不同的面值的货币构成 v 有多少种不同的方案。每种货币的数量不限。We use dynamic programming to count the number of ways to make n cents with the given coins. If we denote the value of the kth coin by c_k, then the recurrence is: nway(n, k) = no. of ways to make n cents with the first k types of coins nway(n, k) = nway... 阅读全文
摘要:
With i and j already chosen, we chose k, which is the number of nodes in the left subtree. Then the number of nodes in the right subtree is known, j-k-1. For depth, at least one subtree has to have depth i-1 so that the new made tree would have depth i. There are three possibilities: the left subtre 阅读全文
只有注册用户登录后才能阅读该文。 阅读全文