Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You have an unlimited number of stamps worth 4 2 c t , 2 0 c t , 8 c t , 3 c t

You have an unlimited number of stamps worth 42ct,20ct,8ct,3ct and
2ct at your disposal
a) Use the greedy algorithm to select how the following values are displayed:
60ct,70ct,85ct
b) Implement the greedy function, which calculates a solution using a greedy
algorithm. Exit with throw runtime_error if no solution is found
c) For which of the values from a) are there solutions for which fewer marks could
be used for the representation than with the greedy algorithm? State the better
solution(s) and the algorithm that calculates them.
d) A function is given that calculates the largest n-digit number with the sum of the
digits of q. The function bigint pow(int x, int y) calculates xy.
Realize the algorithm using a recursive function so that the parameter n is reduced
by one in each recursive call.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

=+18.7. Reconsider Problem 12.12.

Answered: 1 week ago