Question

In: Computer Science

You have made a fortune in Wall Street. The IRS is suspicious and you must launder...

You have made a fortune in Wall Street. The IRS is suspicious and you must launder the money.
You have D dollars and you are considering all the different ways you can divide this amount (in
integer values) to n different criminal groups. Each group can take up to ai dollars without
alerting the IRS. You also have D <=a1 + a2 + .. + an. Using bottom-up dynamic programing,
write pseudo-code to determine how many different ways you can divide the D dollars. What is
the running time of your solution?

Solutions

Expert Solution

Answer :

We are going to use the bottom-up implementation of the dynamic programming to the code.

Our function is going to need the denomination vectors of money(d), the value for which laundering has to be made (n) and number of denominations we have (k or number of elements in the array d) i.e., MONEY-LAUNDER(d, n, k)

Let's start by making an array to store the minimum number of groups needed for each value i.e., M[n+1].

We know that for a value of 0, no groups are needed at all.

M[0] = 0

Now, we need to iterate for each value in array the M and fill it up. Also to store the minimum number of groups for each value, we will make a variable and initialize it with ∞

so that all other values are less than it in the starting.

for j in 1 to n
minimum = INF

Now for each j, we need to choose the minimum of Mn−di+1

, where di will change from d1 to dk and thus, i will change from 1 to k. Also, if the value of di

is greater than j (value to be made), then of course, we can't use that coin.

for j in 1 to n
minimum = INF
for i in 1 to k
if j >= d[i]
minimum = min(minimum, 1 + M[j-d[i]])

for i in 1 to n → We are iterating to change the value of di

from d1 to dk

.

if j >= d[i] → If the value to be made (j) is greater than the value of the current coin (d[i]), only then we can use this coin.

minimum = min(minimum, 1 + M[j-d[i]]) → If the current value of M[j-d[i]] (or Mj−di

) is less than the current minimum, then we are changing the value of the 'minimum'.

Now we just need to change the value of the array M to the calculated minimum and return it.

for j in 1 to n
minimum = INF
for i in 1 to k
...
M[j] = minimum
return M[n]

pseudo-code:

MONEY-LAUNDER(d, n, k)
M[n+1]
M[0] = 0

for j in 1 to n
minimum = INF

for i in 1 to k
if j >= d[i]
minimum = min(minimum, 1+M[j-d[i]])

M[j] = minimum
return M[n]
The time for each sub-problem is O(1), so the total run time of the code will be O(nD) n->no.of denomination D->amount of money

I hope this answer is helpful to you, please upvote my answer. I'm in need of it.. Thank you..


Related Solutions

Ben Graham stated that "if you want to make money on Wall Street, you must have...
Ben Graham stated that "if you want to make money on Wall Street, you must have the proper psychological attitude." Quoting the philosopher, Spinoza, Graham said "you must look at things in the aspect of eternity". What does this mean? How did this change Warren Buffet's life and the trajectory of investor psychology? And does this investment guidance hold true given the unprecedented swings in the stock market today?
choose an article featured on the website (Wall Street Journal, Businessweek, Fortune or Reuters Business News...
choose an article featured on the website (Wall Street Journal, Businessweek, Fortune or Reuters Business News Headlines) that relates to two of the key concepts listed here: 1) Multinational corporation, 2) Corporate responsibility, 3) Ethics, 4) Conceptual skills, 5) Product liability Then explain in 5-7 sentences why the article you have selected relates to the concepts you chose. At the end of the post, include the link to the online article referenced in your post. Feel free to choose any...
Look at the company's web page and news stories (Wall Street Journal, Fortune, Forbes, BusinessWeek, etc.)...
Look at the company's web page and news stories (Wall Street Journal, Fortune, Forbes, BusinessWeek, etc.) to describe one of the following companies' corporate strategy AND what changes they've made at least in the last 3 years to their corporate portfolio. (Correctly) use as many appropriate corporate strategy concepts as you can. Do you think their corporate strategy has been a success? Why or why not? (remember to support your opinion with data or text material). Here are the companies:...
choose an article featured on the website(Wall Street Journal, Businessweek, Fortune or Reuters Business News Headlines)...
choose an article featured on the website(Wall Street Journal, Businessweek, Fortune or Reuters Business News Headlines) that relates to two of the key concepts listed here: capitalism - economics - free-market economies - accounting - business intelligence Then explain in 5-7 sentences why the article you have selected relates to the concepts you chose include the link to the online article referenced in your post. Article: https://www.bloomberg.com/view/articles/2017-03-23/capitalism-will-shrink-inequality-in-fact-it-s-happening
using any popular business periodicals (such as bloomberg businessweek, fortune, Wall Street journal, fast company), find...
using any popular business periodicals (such as bloomberg businessweek, fortune, Wall Street journal, fast company), find examples of managers doing each of the four management functions. Write up a description and explain how these are examples of that function. Please cite your source. Four management functions: Planning, organizing, leading and controlling
Identify an article in a popular, business-oriented publication (e.g. Wall Street Journal, Fast Company, Fortune, Wired,...
Identify an article in a popular, business-oriented publication (e.g. Wall Street Journal, Fast Company, Fortune, Wired, etc.) that illustrates how a company is successfully encouraging employee productivity and performance through their total compensation and rewards strategy. What innovative strategies are they using to really drive employee performance? Please provide a full citation and link to the article so that your classmates can also benefit from what you learned.
dentify an article in a popular, business-oriented publication (e.g. Wall Street Journal, Fast Company, Fortune, Wired,...
dentify an article in a popular, business-oriented publication (e.g. Wall Street Journal, Fast Company, Fortune, Wired, etc.) that illustrates a current or past ethical dilemma experienced by a corporate business executive. What innovative strategies are corporations using to make sure that senior leaders make sound and ethical decisions?
You have corrupt friends in Wall Street that supply you with the following information: the stock...
You have corrupt friends in Wall Street that supply you with the following information: the stock price of ten fraudulent companies every month for a year. You have access to the data for the entire year in advance. You would like to use this information to get as rich as possible by the end of the year. At the start of every month k, you look at the table S[i,k], which gives you the average return on on a $1...
Interpret the following statements made by Wall Street analysts and portfolio managers. a. “The existence of...
Interpret the following statements made by Wall Street analysts and portfolio managers. a. “The existence of financial futures contracts allows our firm to hedge against temporary market declines without liquidating our portfolios.” b. “Given my confidence in the market, I plan to use stock index futures to increase my exposure to market movements.” c. “We used currency futures to hedge the exchange rate exposure of our international mutual fund focused on German stocks.”
Describe the history and current issues facing Wall Street. What did you learn about Wall Street...
Describe the history and current issues facing Wall Street. What did you learn about Wall Street that surprised you? What questions do you still have?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT