MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / findMin

Function findMin

CPP/Greedy_algorithm.cpp:9–26  ·  view source on GitHub ↗

Driver program

Source from the content-addressed store, hash-verified

7
8// Driver program
9void findMin(int V)
10{
11 // Initialize result
12 vector<int> ans;
13
14 // Traverse through all denomination
15 for (int i = n - 1; i >= 0; i--) {
16 // Find denominations
17 while (V >= deno[i]) {
18 V -= deno[i];
19 ans.push_back(deno[i]);
20 }
21 }
22
23 // Print result
24 for (int i = 0; i < ans.size(); i++)
25 cout << ans[i] << " ";
26}
27
28// Driver program
29int main()

Callers 1

mainFunction · 0.85

Calls 2

push_backMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected