Algorithm using java programming language

Assignment Help Data Structure & Algorithms
Reference no: EM131449709

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

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 weeki - 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 weeki 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 JAVA programming language.

Verified Expert

This paper tells about the dynamic programming technique where in the problem solutions are implemented in java. The 1st solution says about the technique finding the longest common sub-sequence where characters of two different strings are scanned to get a match and is returned if there a match. The 2nd solution speaks about finding the optimal solution for a series of week with high stress and low stress job given. The revenue is selected depending on the choice of high stress job, low stress job or none. Finally the optimality value is calculated and displayed.

Reference no: EM131449709

Questions Cloud

Describe an additional social role related to the norm : Select one agent of socialization and describe a specific norm that one might learn from that source. Be sure to describe the process of how the norm you chose is learned and internalized. Then, discuss how the norm might influence a particular so..
Sampling distribution of the sample proportion : Find the expected value of the sampling distribution of the sample proportion.
Discuss ways to minimize the likelihood of discrimination : Based on your reading of the major EEO laws, discuss ways to minimize the likelihood of discrimination and maximize the benefits of diversity in the workplace.
Construct a symmetric mixed-strategy equilibrium : Consider a simultaneous-move auction in which two players simultaneously choose bids, which must be in nonnegative integer multiples of one cent.
Algorithm using java programming language : Design a dynamic programming algorithm to find the value of the optimal plan. Implement your algorithm using JAVA programming language.
Change in a government impacts the oil industry : Explain why or why not - using 3-4 examples to support your opinion. Also include how the change in a government impacts the oil industry with 1 example.
Describe a little about the fsa program : Describe a little about the FSA program.Find a social documentary photograph from an FSA photographer that youResearch the social realists who worked.
Solve the iterated strict dominance : Consider an arbitrary two-player game with action spaces A1 = A2 = [0,1] and payoff functions that are twice continuously differentiable and concave in own.
Discuss the impact of the local community or local culture : SOC 2010 : How does the place of interest impact the local community or local culture in a positive and or negative way (tourism? recreation? jobs? beauty?

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Implement an open hash table

In this programming assignment you will implement an open hash table and compare the performance of four hash functions using various prime table sizes.

  Use a search tree to find the solution

Explain how will use a search tree to find the solution.

  How to access virtualised applications through unicore

How to access virtualised applications through UNICORE

  Recursive tree algorithms

Write a recursive function to determine if a binary tree is a binary search tree.

  Determine the mean salary as well as the number of salaries

Determine the mean salary as well as the number of salaries.

  Currency conversion development

Currency Conversion Development

  Cloud computing assignment

WSDL service that receives a request for a stock market quote and returns the quote

  Design a gui and implement tic tac toe game in java

Design a GUI and implement Tic Tac Toe game in java

  Recursive implementation of euclids algorithm

Write a recursive implementation of Euclid's algorithm for finding the greatest common divisor (GCD) of two integers

  Data structures for a single algorithm

Data structures for a single algorithm

  Write the selection sort algorithm

Write the selection sort algorithm

  Design of sample and hold amplifiers for 100 msps by using n

The report is divided into four main parts. The introduction about sample, hold amplifier and design, bootstrap switch design followed by simulation results.

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