subject

Description:
In this assignment, you are asked to implement a dynamic programming algorithm for the matrix chain multiplication problem, where the goal is to find the most computationally efficient matrix order when multiplying an arbitrary number of matrices in arow. You can assume that the entire input will be given as integers that can be stored using the standard C int type and that matrix sizes will be at least 1.

Input:
The input has the following format. The first number, n β‰₯ 1, in the test case will tell you how many matrices are in the sequence. The first number will be then followed by n + 1 numbers indicating the size of the dimensions of the matrices. Recall that the given information is enough to fully specify the dimensions of the matrices to be multiplied.
Output:
First, you need to output the minimum number of scalar multiplications needed to multiply the given matrices. Then, print the matrix multiplication sequence, via parentheses, that minimizes the total number of number multiplications and the . for multiplication symbol. Each matrix should be named A#, where # is the matrix number starting at 0 (zero) and ending at n βˆ’ 1. See the examples below.

Examples of input and output:
2
2 3 5
30
(A0.A1)

3
10 100 5 50
7500
((A0.A1).A2)

3
10 30 5 60
4500
((A0.A1).A2)

6
30 35 15 5 10 20 25
15125
((A0.(A1.A2)).((A3.A4).A5))

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 01:50
Click on this link toopens a new window. bring up a flowchart in a new browser window. based on this flowchart, would a d-link 3347 gateway with an xbox 360 multiplayer problem be in scope or out of scope
Answers: 2
question
Computers and Technology, 22.06.2019 23:00
Is an attack that relies on guessing the isns of tcp packets
Answers: 2
question
Computers and Technology, 23.06.2019 05:20
What did creator markus β€œnotch" persson initially call his game
Answers: 1
question
Computers and Technology, 23.06.2019 18:30
Write a program that prints the day number of the year, given the date in the form month-day-year. for example, if the input is 1-1-2006, the day number is 1; if the input is 12-25-2006, the day number is 359. the program should check for a leap year. a year is a leap year if it is divisible by 4, but not divisible by 100. for example, 1992 and 2008 are divisible by 4, but not by 100. a year that is divisible by 100 is a leap year if it is also divisible by 400. for example, 1600 and 2000 are divisible by 400. however, 1800 is not a leap year because 1800 is not divisible by 400.
Answers: 3
You know the right answer?
Description:
In this assignment, you are asked to implement a dynamic programming algorithm fo...
Questions
question
English, 23.02.2021 17:50
question
Mathematics, 23.02.2021 17:50