Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Business Management Expert

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

Business Management, Management Studies

  • Category:- Business Management
  • Reference No.:- M91422804
  • Price:- $30

Priced at Now at $30, Verified Solution

Have any Question?


Related Questions in Business Management

Help formulate a program python script named mycalcpy which

Help formulate a program (Python script) named mycalc.py, which implements a simple calculator using python. Submit a script file(.py or .txt) and an output file (.doc or .pdf). Don't forget to use comments and readable ...

Social medias effect on loyaltyinstructions follow

Social Media's Effect on Loyalty Instructions: Follow carefully Visit a website such as Amazon or Barnes and Noble and locate three recent books that discuss the effects of social media on customer loyalty and retention. ...

What are examples of structures that provide governancewhat

What are examples of structures that provide "governance"? What are examples of positions that provide "management"? How familiar are you with your organization's governance and management?

Toy wooden blocks are packaged in bags of 9 one bag

Toy wooden blocks are packaged in bags of 9. One bag contains 6 maple blocks and 3 birch blocks, while a second bag contains 5 maple blocks and 4 birch blocks. One block is drawn from the first bag and placed into the se ...

Bull draft a one-two sentence personal definition of

• Draft a one-two sentence personal definition of leadership. Base your definition on what you have encountered, as well as on what you have already know about leadership. • Discuss the statements: "Leadership is everybo ...

What choices does one have to make when deciding on health

What choices does one have to make when deciding on health care coverage options? What are consumer health care costs in today's market?

Identify a typical type of project in your profession or

Identify a typical type of project in your profession or field of study. Research the top two to three most common project costing/estimating techniques used for this type of projects. Provide the following: Name the pro ...

Concerned case is tucker graphics v nihon ichibanplease

Concerned case is: Tucker Graphics v. Nihon Ichiban Please focus on questions such as these: Please focus on defending Nihon Ichiban. Pretend to be the attorny and call out witnesses what will your witnesses focus on say ...

What is norways global health issues and how can they be

What is Norway's global health issues and how can they be combated?

Equipment maintenance costs for manufacturing

Equipment maintenance costs for manufacturing explosion-proof pressure switches are projected to be $125,000 in year one and increase by 3.5% each year through year five. What is the equivalent annual worth of the mainte ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As