Design a dynamic programming algorithm

Assignment Help JAVA Programming
Reference no: EM131449088

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 li 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 speci?ed 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 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.)

Example: Suppose n=4, and the values of li and hiare 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

l

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.

Verified Expert

In this project, I have created a JAVA program to implement the code of computing longest common sub-sequence between the two strings and to compute the value of optimal revenue plan. The client/driver program prompts the user to enter the two string values among which a common subsequent needs to be printed. Further for optimal revenue plan value, user is prompted to enter the number of weeks and the revenue value for low and high stress job for each week. The value of optimal plan is printed.

Reference no: EM131449088

Questions Cloud

Workers a wage above the market equilibrium : Why might some firms voluntarily pay workers a wage above the market equilibrium, even in the presence of surplus labor? Check all that apply.
Identify the critical components of logistics operation : Examine the key issues affecting logistics in this example and highlight other examples.
Would you favor or oppose greater consolidation : The fragmentation and redundancies of the U.S federal system are expensive in terms of coordination and personnel costs. Would you favor or oppose greater consolidation? Why or why not?
Determining the international law : This last week's reading from our book solidified a concept that I was entertaining since Week 1; much of International Law is established through.
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.
Define ethical criticism : Do you agree with the thought expressed in this chapter that a frm confronted with strong ethical criticism should abandon the product.
Define each protocol and describe two data transmission : Define each protocol and describe at least two data transmission technologies associated with the protocol. Include bandwidth limitations of each technology.
Generate a random reference string of length : Generate a random reference string of length - Run FIFO page replacement algorithm. ?Draw a graph and show the relationship between number of frames vs number of page fault
Explain the maxwell distribution : (The Maxwell distribution). Denote by = (1, 2, 3)T the velocity vector of a gas particle.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic 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