Consider the following algorithm to make change. The algorithm takes as input:
• tr, the amount of change to make. • p, the base of the denomination set (the “coins” are powers of p).
IN: n, p E N = 1, 2, … p > 1 1: D ; 2: C 3: r 4—n 4: while r > 0 do 5: x 4— max(x E Dix
(a) Which of the following best describes the algorithm above (circle one): divide-and-conquer dynamic greedy
(b) Prove that the algorithm is fully correct. You should start by finding a suitable loop invariant for partial correctness. Note that for any p > I:
pn = 1 + E (ps(p— I)) ce

Found something interesting ?

• On-time delivery guarantee
• PhD-level professional writers
• Free Plagiarism Report

• 100% money-back guarantee
• Absolute Privacy & Confidentiality
• High Quality custom-written papers

Related Model Questions

Feel free to peruse our college and university model questions. If any our our assignment tasks interests you, click to place your order. Every paper is written by our professional essay writers from scratch to avoid plagiarism. We guarantee highest quality of work besides delivering your paper on time.

Grab your Discount!

25% Coupon Code: SAVE25
get 25% !!