Design a dynamic programming algorithm

Assignment Help Programming Languages
Reference no: EM132747932

Question 1. Write a program to solve the Longest Common Subsequence problem using dynamic programming as discussed in class. For example, if the input is X = ABCBDAB and Y = BDCABA, then the output of your program should be BCBA.

Question 2. Suppose you need to create a work plan, and each week you have to choose a job to undertake. The set of possible jobs is divided into low-stress and high-stress jobs.

If you select a low-stress job in week i, then you get a revenue of 1 dollars; if you select a high-stress job, you get a revenue of hi dollars. The catch, however, is that in order for you to take on a high-stress job in week i, it's required that you rest in week i - 1 because you need a full week of prep time to get ready for the stress level (It's okay to choose a high-stress job in week 1.) On the other hand, you can take a low-stress job in week i even if you 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 constraint that if "high-stress" is chosen for week i > 1, then "none" must be chosen for week i - 1. The value of the plan is determined in the natural way; for each i, you add /i 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.)

Example: Suppose n=4, and the values of /i and h are given by the following table. Then the plan of the 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.

i

Week 1

Week 2

Week 3

Week 4

/

10

1

10

10

h

5

50

5

1

Design a dynamic programming algorithm to find the value of the optimal plan. Implement your algorithm using any programming language you prefer.

Reference no: EM132747932

Questions Cloud

How much capital is to be credited to Sunshine : Prepaid items amount to P5,000. Paulo is to be admitted as a partner upon investing P200,000 cash, How much capital is to be credited to Sunshine
Managing change in organizations : Discuss the role of Leadership in planning and managing change in organizations.
Transformation at ing-blockchain : Describe how the Company Proposition changed as a result of the Digital Transformation
How to restore the credibility of the accounting profession : How to restore the credibility of the accounting profession and investor confidence in the financial reporting process? The response must be typed.
Design a dynamic programming algorithm : Design a dynamic programming algorithm to find the value of the optimal plan. Implement your algorithm using any programming language you prefer.
Best corporate governance practices : Attempt it with due diligence: "Best Corporate Governance Practices, for all intent and purposes rest on the shoulders of Independent Non-Executive Directors"
Calculate the weighted average unit contribution margin : Total annual fixed costs are $5,000,000. Assume the sales mix remains the same at all levels of sales. Calculate the weighted average unit contribution margin
Bobsville hazard vulnerability assessment : In EDMG101, the 2nd assignment which is due in the 3rd week the Bobsville Hazard Vulnerability Assessment.
Promote organizational performance : In what ways do goals and objectives help managers control various processes within an organization?

Reviews

Write a Review

Programming Languages Questions & Answers

  Write a haskell program to calculates a balanced partition

Write a program in Haskell which calculates a balanced partition of N items where each item has a value between 0 and K such that the difference b/w the sum of the values of first partition,

  Create an application to run in the amazon ec2 service

In this project you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Write functions

These 14 questions covers java class, Array, link list , generic class.

  Programming assignment

If the user wants to read the input from a file, then the output will also go into a different file . If the user wants to read the input interactively, then the output will go to the screen .

  Write a prolog program using swi proglog

Write a Prolog program using swi proglog

  Create a custom application using eclipse

Create a custom Application Using Eclipse Android Development

  Create a application using the mvc architecture

create a application using the MVC architecture. No scripting elements are allowed in JSP pages.

  Develops bespoke solutions for the rubber industry

Develops bespoke solutions for the rubber industry

  Design a program that models the worms behavior

Design a program that models the worm's behavior.

  Writing a class

Build a class for a type called Fraction

  Design a program that assigns seats on an airplane

Write a program that allows an instructor to keep a grade book and also design and implement a program that assigns seats on an airplane.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd