HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

Complexity of recursive solution to coin change

Submitted by: @import:stackexchange-cs··
0
Viewed 0 times
coinrecursivesolutionchangecomplexity

Problem

How do you go about analysing coin change recursive solution. i.e,
T(N,K) = T(N,K-1) + T(N-1,K) for K denominations that add up to amount N.

You can find the problem description and pseudo code here - http://www.algorithmist.com/index.php/Coin_Change#Recursive_Formulation

Solution

A general method for solving recurrences of this form is generating functions. The exact solution also depends on the initial values. In your case, one possible solution is $T(n,k) = C 2^{n+k}$.

Context

StackExchange Computer Science Q#13017, answer score: 2

Revisions (0)

No revisions yet.