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

  Create test-methods for each operations

Write the methods to pass the tests. A significant portion of your score will be based on the effectiveness and thoroughness of your test-methods.

  Describes an accusation of fact that a crime

Describes an accusation of fact that a crime has been committed.a. attrition

  How to produce javascript code

Using the prompt and alert functions, invite the user to input 5 marks (integers) in the range 0-100.

  Build a perl program that will gather user input

This assignment introduces you to the Perl language and CGI programming. You will use your scripting and html skills to build a Perl program that will gather user input to then generate a personal webpage.

  Create a program for a ledger''s furniture store

Create a program for a Ledger's Furniture Store. Create a pseudocode program using Notepad++ to solve this problem. Third, create the program with RAPTOR.

  Programming languages features

Test your skills in programming applications to specification in a number of different programming languages - implement or incorporate additional language

  Identify a list of function/menus that need to be test

The task is to use Equivalence Class partitioning and Boundary Value Analysis (which means to test the input at the boundary of the equivalence class partition) to analyze the valid and invalid inputs for Microsoft WinWord or any other software pa..

  Performance comparison- rsa versus aes

Exercise the idea that digital certificates are verified using a chain of trust. The trust anchor for the digital certificates is the Root Certificate Authority (CA)

  Use two-dimensional array in javascript to solve problem

Using javascript. Use a two-dimensional array to solve the following problem: A company has four salespeople (1 to 4) who sell five different products (1 to 5).

  Calculate how many days are between dates

comparative overview of the languages highlighting how they were suitable or not suitable for the creating this type of application is also required.

  Compare the points by y major order

Compare the Points by y major order, that is, points with similar y-coordinate values should come before those with higher y coordinate values. Break ties by comparing x-coordinate values.

  Design a program that calculate the percentage

You have been asked to design a program that will allow a teacher to calculate the percentage and the final grade for students in a class

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