3. Fun with Reductions. (15 points) Suppose the economies of the world use a set of currencies C1, ...,Cn; think of these as dollars, pounds, Bitcoin, etc. Your bank allows you to trade each currency C; for any other currency C;, and finds some way to charge you for this service. Suppose that for each ordered pair of currencies (Ci,C;), the bank charges a flat fee of fij > 0 dollars to exchange C; for C; (regardless of the quantity of currency being exchanged). Describe an algorithm which, given a starting currency Cg, a target currency Ct, and a list of fees fij for all i, j e {1,..., n}, computes the cheapest way (that is, incurring the least in fees) to exchange all of our currency in C, into currency Ct. Also, justify the its runtime. (We are expecting a description or pseudocode (either is OK) of your algo- rithm, as well as a brief justification of its runtime. You can use any algorithm we have learned in class.]

Respuesta :