Hi,
Please help me with this problem, im reading algorithms
i've seen a problem called "Coin Change"
the algorithm located here: http://www.algorithmist.com/index.php/Coin_Change
i have problem in implementation in C++, can anyone please help me with the base case.
I have no idea how to fill the array with base cases.
void coinBuild(void)
{
for(int i = 0; i < MAX; i++)
{
for(int j = 0; j < 5; j++)
{
if(i == 0)
dyna[i][j] = 1;
else if(i <= 0)
dyna[i][j] = 0;
else if(i >= 1 && j <= 0)
dyna[i][j] = 0;
else
dyna[i][j] = dyna[i][j - 1] + dyna[i - coin[j]][j];
}
}
}