Dynamic Programming

Quiz 4 Advanced Algorithm Analysis Marks 20Q 1. (10 points) Team work. You’re managing a consulting team of expert computer hackers, and each week you have to choose a job for them to undertake. Now, as you can well imagine, the set of possible jobs is divided into those that are low-stress (e.g., setting up a website) and those that are high-stress (e.g., approaching deliverable deadlines for a major client). The basic question, each week, is whether to take on a low-stress job or a high-stress job.If you select a low-stress job for your team in week i, then you get a revenue of li > 0 dollars; if you select a high-stress job you get a revenue of hi > 0 dollars. The catch, however, is that in order for the team to take on a high-stress job in week i, it’s required that they do no job (of either type) in week i − 1; they need a full week of prep time to get ready for the crushing stress level. On the other hand, it’s okay for them to take a low stress job in week i even if they have done a job (of either type) in week i − 1. So, given a sequence of n weeks, a plan is specified by a choice of “low-stress,” “high-stress,” or “none” for each of the n weeks, with the property that if “high-stress” is chosen for week i > 1, then “none” has to be chosen for week i − 1. (It’s okay to choose a high-stress job in week 1.) The value of the plan is determined in the natural way: for each i, you add li to the value if you choose “low-stress” in week i, and you add hi to the value if you choose “high-stress” in week i (You add 0 if you choose “none” in week i.)The problem. Given sets of values l1, l2, · · · , ln and h1,h2, · · · ,hn, find a plan of maximum value. (Such a plan will be called optimal.)Example. Suppose n = 4, and the values of li and hi are given by the following table. Then the plan of maximum value would be to choose “none” in week 1, a high-stress job in week 2, and low-stress jobs in weeks 3 and 4. The value of this plan would be 0 + 50 + 10 + 10 = 70.Week 1 Week 2 Week 3 Week 4l 10 1 10 10 h 5 50 5 1First try. Below is an algorithm to plan the jobs taken.For iterations i = 1 to n If hi+1 > li + li+1 thenOutput ‘‘Choose no job in week i’’ Output ‘‘Choose a high-stress job in week i + 1’’ Continue with iteration i + 2Else Output ‘‘Choose a low-stress job in week i’’ Continue with iteration i + 1End If End ForTo avoid problems with overflowing array bounds, we define hi = li = 0 when i > n.(a) (3 points) Show that the above algorithm does not correctly solve this problem, by giving an instance on which it does not return the correct answer. In your example, say what the correct answer is and also what the above algorithm finds. Now use dynamic programming. Work out an efficient algorithm that takes values for l1, l2, · · · , ln and h1,h2, · · · ,hn and returns the value of an optimal plan.(b) (2 points) Draw the linearized DAG (topological ordering) for the example in the problem statement.(c) (2 points) List down the optimal substructure for the problem.(d) (4 points) Write the recursive formulation using the substructure.(e) (3 points) Write the enumerated pseudocode of the solution.(f) (2 points) How many subproblems?(g) (2 points) What is the time per subproblem?(h) (2 points) Determine the total running time?Page 1 of 1

Don't use plagiarized sources. Get Your Custom Essay on
Dynamic Programming
From $8/Page
Order Essay
Full satisfaction or return your money back

Our experts will write you a top-quality paper and revise it an unlimited number of times until you're 100% satisfied - or offer a refund.

Check Prices
Get the best discount and better grades here
Pages (550 words)
*Price with a welcome 15% discount applied.
Pro tip: If you want to save more money and pay the lowest price, you need to set a more extended deadline.
We know that being a student these days is hard. Because of this, our prices are some of the lowest on the market.

Instead, we offer perks, discounts, and free services to enhance your experience.
Sign up, place your order, and leave the rest to our professional paper writers in less than 2 minutes.
step 1
Upload assignment instructions
Fill out the order form and provide paper details. You can even attach screenshots or add additional instructions later. If something is not clear or missing, the writer will contact you for clarification.
How to get the most out of your experience with Toptutor4me
One writer throughout the entire course
If you like the writer, you can hire them again. Just copy & paste their ID on the order form ("Preferred Writer's ID" field). This way, your vocabulary will be uniform, and the writer will be aware of your needs.
The same paper from different writers
You can order essay or any other work from two different writers to choose the best one or give another version to a friend. This can be done through the add-on "Same paper from another writer."
Copy of sources used by the writer
Our college essay writers work with ScienceDirect and other databases. They can send you articles or materials used in PDF or through screenshots. Just tick the "Copy of sources" field on the order form.
Here is what our happy clients say about us.
Receiving customer feedback and reviews from legit students who have utilized our services is one of our favorite part of the job. We love seeing testimonials from happy students whom we have helped to succeed. Read through the below review page to see what our partners think.
Thank you! It was great :)
Customer 452483, July 26th, 2021
Excellent!!! Thank you.
Customer 452487, September 13th, 2021
Introduction to Sociology
Thank you very much for all of your hard work!
Customer 452483, October 15th, 2021
English 101
Perfect! Very informative! Appreciate all of your hard work! Thank you very much.
Customer 452483, September 22nd, 2021
Very clear, and complete information presented. I, thank you for all of your hard work, appreciate it!
Customer 452483, August 9th, 2021
Thank you so much for revising this paper for me. It looks great, truly appreciate it! You're awesome :)
Customer 452483, September 14th, 2021
Appreciate all of your hard work! Thank you so much!!
Customer 452483, September 14th, 2021
Thank you for your hard work; I enjoyed reading the essay and appreciate your writing.
Customer 452483, July 18th, 2021
Healthcare Writing & Communications
Perfect! Thank you so much for all of your help!
Customer 452483, October 31st, 2021
Excellent! Thank you.
Customer 452487, October 16th, 2021
English 101
Amazing thank you!
Customer 452615, August 1st, 2022
Healthcare Writing & Communications
Thank you so much for all of your hard work! Appreciate it all!
Customer 452483, November 14th, 2021
Total Reviews
Satsfaction rate
6 pages
Average paper length
Customers referred by a friend
Enjoy the best prices and lifetime 15% discount
Use a coupon TOP15 and enjoy expert help with any task at the most affordable price.
Order Now Order in Chat