TheAlgorithms/C++ 1.0.0
All the algorithms implemented in C++
|
Minimum coins change problem is a problem used to find the minimum number of coins required to completely reach a target amount. More...
#include <cassert>
#include <climits>
#include <iostream>
#include <vector>
Go to the source code of this file.
Namespaces | |
namespace | dynamic_programming |
Dynamic Programming algorithms. | |
namespace | mincoins_topdown |
Functions for minimum coin exchange problem. | |
Functions | |
template<typename T > | |
int64_t | dynamic_programming::mincoins_topdown::mincoins (const T &n, const std::vector< T > &coins, const int16_t &t, std::vector< T > dp) |
This implementation is for finding minimum number of coins . | |
static void | test () |
Test implementations. | |
int | main () |
Main function. | |
Minimum coins change problem is a problem used to find the minimum number of coins required to completely reach a target amount.
This problem can be solved using 2 methods:
Definition in file coin_change_topdown.cpp.
int main | ( | void | ) |
Main function.
Definition at line 91 of file coin_change_topdown.cpp.
int64_t dynamic_programming::mincoins_topdown::mincoins | ( | const T & | n, |
const std::vector< T > & | coins, | ||
const int16_t & | t, | ||
std::vector< T > | dp ) |
This implementation is for finding minimum number of coins .
T | template-type to use any kind of value |
n | amount to be reached |
coins | vector of coins |
t | deontes the number of coins |
dp | initilised to 0 |
Definition at line 47 of file coin_change_topdown.cpp.
|
static |
Test implementations.
Definition at line 74 of file coin_change_topdown.cpp.