Dynmamic programming algorithms

Assignment Help Business Management
Reference no: EM13853039

For dynmamic programming algorithms, you should:

• Define the table - What does each element of the table hold?

• Give a formula for filling in table locations - this should include both a base case and a recursive case.

• Describe the order in which the table will be filled in (a picture is a good idea here)

• Give pseudocode for your algorithm

1. We want to multiply a chain of matrices together:

M1M2M3M4 . . . Mn

where Mk has dimensions pk-1 × pk for p0 . . . pn.

We want to multiply these matrices in a way that minimizes the total number of scalar multiplications. Show that none of the following greedy algorithms produce optimal solutions in all cases:

(a) First multiply the matrices Mi and Mi+1 whose common dimension is smallest. Recursively find a solution for multiplying M1 ∗. . .∗Mi-1 ∗(Mi ∗Mi+1)∗ . . . ∗ Mn

(b) First multiply the matrices Mi and Mi+1 whose common dimension is largest. Recursively find a solution for multiplying M1 ∗ . . . ∗ Mi-1 ∗ (Mi ∗ Mi+1) ∗ . . . ∗ Mn

(c) Split the problem of multiplying Mi ∗ . . . ∗ Mj into the subproblems of multiplying Mi ∗ . . . ∗ Mk and multiplying Mk+1 ∗ . . . ∗ Mj so that pi-1pkpj is minimized. Recursively solve the subproblems of multiplying Mi . . . Mk and Mk+1 . . . Mj, then multiply the results of the subproblems.

2. Consider the alphabet Σ = {a, b, c} the elements of Σ have the following multiplication table, which is neither communative nor associative:

1890_Multiplication table.jpg

so, ab = b, ba = c, bc = a, cb = c, and so on.

(a) Find a dynamic programming algorithm that examines a string x = x1x2x3 . . . xn and decides whether or not it is possible to parenthesize x such that the value of the resulting expression is a. For example, if x = bbbba, your algorithm should retun "yes", since (b(bb))(ba) = a For the string x = bac, your algorithm should return "no" (since (ba)c = c and b(ac) = c

(b) Modify your algoritm from part a so that instead of returning yes or no, it returns the number of was the expression can be parenthesized to ge the answer a.

3. (8 points) A palindrome is a non-empty string over some alphabet that reads the same forward and backward. Example palendromes are all strings of length 1, civic, racecar, and aibohphobia (fear of palindromes) Give an efficient algorithm to find the longest palindrome that is a subsequence of a given input string. For example, given the input character, your algorithm should return carac. What is the running time of your algorithm?

4. (8 points) Edit Distance In order to transform one string of text x[1 . . . m] to a target string y[1 . . . n], we can perform various transformational operations. Our goal is, given x and y, to produce a series of transformations that changes x to y. We use an array z - assumed to be large enough to hold all of the characters it will need - to hold the intermediate results.

Initially, z is empty, and at termination, we should have z[j] = y[j] for j = 1, 2 . . . , n. We maintain current indices i into x and j into z, and the operations are allowed to alter z and these indices. Initially, i = j = 1. We are required to examine every character in x during the transformation, which means that at the end of the sequence of transformation operations, we must have i = m + 1 There are six transformation operations:

• Copy a character from x to z by setting z[j] ← x[i] and then incrementing both i and j. This operation examines x[i]

• Replace a character from x by another character c, by setting z[j] ← c, and then incrementing i and j. This operation examines x[i]

• Delete a character from x by incrementing i and leaving j alone. This operation examine x[i]

• Insert the character c into z by setting z[j] ← c and then incrementing j, but leaving i alone. This operation examines no characters of x

• Twiddle (i.e., exchange) the next two characters by copying them from x to z but in the opposite order; we do so by setting z[j] ← x[i + 1] and z[j + 1] ← x[i] and then setting i ← i + 2 and j ← j + 2. This operation examines x[i] and x[i + 1]

• Kill the remainder of x by setting i ← m + 1. This operation examines all characters in x that have not yet been examined. If this operation is performed, it must be the final operation

Each of the transformation operations has an associated cost. The cost of an operation depends on the specific application, but we assume that the individual costs are known to us. We also assume that the individual costs of copy and replace operations are less than the combined costs of the delete and insert operations; otherwise, the copy and replace operations would never be used. The cost of a given sequence of transformation operations is the sum of the costs of the individual operations in the sequence.

Given two sequences x[1 . . . m] and y[1 . . . n] and a set of transformation operator costs, the edit distance from x to y is the cost of the least expensive operation sequence that transforms x to y. Describe a dynamic programming algorithm that finds the edit distance from x[1 . . . m] to y[1 . . . n] and prints an optimal operation sequence. Analyze the running time and space requirements of your algorithm

Reference no: EM13853039

Questions Cloud

Let pie be the plane through q : Let pie be the plane through q(2,0,0) with normal (1,-1,1) . Find the distance between this plane and the point p(1,0,2)
Find an equation in point-normal form : Find an equation in point-normal form for the plane described by the equation 2x-3y+z=6
Explain issue of mortgagee or agent selling to themselves : Explain the issue of Mortgagee or agent selling to themselves (or through a company in which they own) and Duty of good faith when exercising power of sale.
Which of the following vectors is a normal : Which of the following vectors is a normal to a line perpendicular to the line (x,y)=(3,4)+t(-5,6)
Dynmamic programming algorithms : For dynmamic programming algorithms, you should: Define the table - What does each element of the table hold? Give a formula for filling in table locations - this should include both a base case and a recursive case.
Calculate the pearson product-moment correlations : Calculate the Pearson product-moment correlations between two interval/ratio variables in your assigned data set from Week Two
Prepare summary journal entries to record marchs transaction : Prepare T-accounts showing how the above costs flow through the accounting system. For simplicity, you may assume that all expenditures and receipts settle in cash.
Direct labor and the remainder was for indirect labor : $84,000 in raw materials were requisitioned for use in production. Of this amount, $72,000 was for direct materials and the remainder was for indirect materials. Total labor wages of $108,000 were incurred. Of this amount, $105,000 was for direct lab..
The distribution of costs using abc for boeing : Evaluate and discuss whether Boeing could benefit by using Activity Based Costing (ABC). The discussion should include what factor(s) influenced your decision, the ramifications of implementing ABC in the international business environment of Boeing,..

Reviews

Write a Review

Business Management Questions & Answers

  Supply chain disruptions of the magnitude of the japan

Supply chain disruptions of the magnitude of the Japan tsunami are, fortunately, not frequent. On the other hand, breakdowns resulting from labor and political unrest, infrastructure congestion, as well as other stoppages caused by floods, fire, etc...

  Show the problem solving process

Identify which step of the problem-solving process was the easiest to complete, most difficult to complete, and why.

  Determine the credibility of a source of information

What criteria do you recommended to determine the credibility of a source of information? Develop a list of no less than 10 elements you would use to determine the credibility of facts, articles, websites, news, etc. Thoroughly explain each element a..

  What problems are managers facing

What problems are managers facing and/or key persons in this particular organization? Identify the symptoms and root causes of the problems while determining the short-term solutions for their problems

  Calculate the fixed costs

Calculate the fixed costs of your workplace or employer? Fixed costs entail more risk than variable costs.

  How has your iphone changed your career

Identify two (2) technological innovations that have changed the fundamental manner in which companies have conducted business over the last 20 years, and recognize one (1) aspect of each that has impacted your own career. What piece of technol..

  What decision-making process would work better

What cultural differences do you need to be sensitive to in the process. For example, what would you expect from the Arab negotiator versus the Russian negotiator who will be working with you, the American negotiator

  Addresses issues in management and leadershipwhat can a

addresses issues in management and leadership.what can a managerial team do to avoid the lack of opportunities for

  Explain the theory of operant conditioning

Explain the theory of operant conditioning and Compare and contrast positive and negative reinforcement and Determine which form of reinforcement is the most effective

  Describe who was the offered and the offered

Was this a bilateral or unilateral contract? Describe who was the offered and the offered in this situation? Why?

  Three-year moving averagedata collected on the yearly

three-year moving averagedata collected on the yearly registration for a seminar at gips are shown in the following

  Medical recordyou are working on a hospital unit that is

medical recordyou are working on a hospital unit that is going to transition some of its medical record information

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