1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Olegator [25]
4 years ago
9

Implement the make change algorithm you designed in the previous problem. Your program should read a text file "data.txt" where

each line in "data.txt" contains three values c, k and n. Please make sure you take your input in the specified order c, k and n. For example, a line in "data.txt" may look like the following:3 4 38
where c = 3,k = 4,n = 38. That is, the set of denominations is {30,31,32,33,34} = {1,3,9,27,81}, and we would like to make change for n = 38. The file "data.txt" may include multiple lines like above.

The output will be written to a file called "change.txt", where the output corresponding to each input line contains a few lines. Each line has two numbers, where the first number denotes a de- nomination and the second number represents the cardinality of that denomination in the solution. For example, for the above input line ‘3 4 38’, the optimal solution is the multiset {27, 9, 1, 1}, and the output in the file "change.txt" is as follows:

27 1 91 12

which means the solution contains 1 coin of denomination 27, one coin of 9 and two coins of denomination
Computers and Technology
1 answer:
Tanya [424]4 years ago
4 0

Answer:

Answer explained below

Explanation:

Below is the code for Greedy change algorithm in C++. Please let me know what  does c ,k and represent in the question. so that i can update according to requirement

#include <bits/stdc++.h>  

using namespace std;  

int deno[] = { 1, 3,9,27,81 };  

int n = sizeof(deno) / sizeof(deno[0]);  

void findMin(int V)  

{  

   // Initialize result  

   vector<int> ans;  

   // Traverse through all denomination  

   for (int i = n - 1; i >= 0; i--) {  

       // Find denominations  

       while (V >= deno[i]) {  

           V -= deno[i];  

           ans.push_back(deno[i]);  

       }  

   }  

   // Print result  

   for (int i = 0; i < ans.size(); i++)  

       cout << ans[i] << " ";  

}  

int main()  

{  

   int n = 38;  

   cout << "Following is minimal number of change for " << n << ": ";  

   findMin(n);  

   return 0;  

}

You might be interested in
Join me to play mm2<br><br><br>in r0bl0x​
jenyasd209 [6]
Ok what's the code i will join
4 0
3 years ago
Read 2 more answers
Consider a tcp connection between host b and server
katrin2010 [14]
TCP stands for Transmission Control Protocol for Communication of the Internet.  It is used to  interconnect network devices on the Internet and it is a connection oriented protocol which means that the connection between the devices (in our case host b and sever C) is established and maintained until they finish to exchange messages. Source port number specifies the <span>application or services on host b and destination port number on host c. 
a. </span><span>The source and destination port numbers for the segments traveling from host c to host b are : source: 443 , destination: 2345.
b. From the destination port number (443) we can deduce that the server c that it is a web server. Port 443 is the standard port number for website which use SSL</span><span>(</span>Secure Sockets Layer<span>) .SSL is the standard security technology for establishing an encrypted link between a web server and a browser. </span>
7 0
3 years ago
Libreoffice is an example of which type of software?.
max2010maxim [7]

LibreOffice is an Open Source Software.

<h3>Open Source Software (OSS)</h3>

A software is classified as <u>Open Source</u> when your code can be use, modified and distribute with its original rights.

<h3>LibreOffice</h3>

For answering this question, you should know a software LibreOffice.

LibreOffice is a software that allows to create: sheets, documents, drawing, charting, database, presentations, etc. It's free and an open source software - main advantages when compared to other software available.

In the other words, LibreOffice is free because the user does not need to pay any license. Also, it is an open source software because your code can manipulate for any developer.

Read more about Open Source Software here:

brainly.com/question/4593389

3 0
3 years ago
Telepresence provides the opportunity for people to work from home and attend virtually. True False
ira [324]
The answer is true.
Telepresence is essentially things like video-chat that allows people to participate in meetings even if they are not physically present.

I hope this helps! :)
~ erudite 
7 0
3 years ago
Read 2 more answers
Systems management involves allocation of computer resources to keep all processes operating smoothly and at maximum efficiency.
olchik [2.2K]

Answer:operating system (OS), program that manages a computer's resources, especially the allocation of those resources among other programs. Typical resources include the central processing unit (CPU), computer memory, file storage, input/output (I/O) devices, and network connections.

Explanation:

8 0
3 years ago
Other questions:
  • On the CallCenterReport worksheet, add formulas that will summarize the issues for the department entered in cell B3. In cell B6
    13·1 answer
  • Melissa is the network administrator for a small publishing company. as network administrator, she is in charge of maintaining t
    8·1 answer
  • What are all the folders located on the DOCK called?
    11·1 answer
  • Kash has created a document that needs to be protected. only certain users should be able to open the document. what option shou
    5·1 answer
  • URGENT: I need to add a while loop in this program but I don't know-how. I am also having trouble neatening some lines of code.
    15·1 answer
  • Full form of DVX please answer fast ​
    9·1 answer
  • which driver must be running and configured to enable a PC to communicate with a CompactLogix PLC on an Ethernet network
    10·1 answer
  • What are the peripherals of a computer ​
    12·1 answer
  • A(an)_______is built-in preset calculation. <br>formula <br> function <br>equation <br>AutoSum​
    12·1 answer
  • Which type of malware prevents you from accessing files stored on your computer?
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!