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 09:40
Sarah is having a hard time finding a template for her advertising business that she may be able to use at a later date and also make it available to her colleagues
Answers: 1
question
Computers and Technology, 22.06.2019 20:00
What is the worst-case complexity of the maxrepeats function? assume that the longest string in the names array is at most 25 characters wide (i.e., string comparison can be treated as o( class namecounter { private: int* counts; int nc; string* names; int nn; public: namecounter (int ncounts, int nnames); int maxrepeats() const; }; int namecounter: : maxrepeats () { int maxcount = 0; for (int i = 0; i < nc; ++i) { int count = 1; for (int j = i+1; j < nc; ++j) { if (names[i] == names[j]) ++count; } maxcount = max(count, maxcount); } return maxcount; }
Answers: 3
question
Computers and Technology, 23.06.2019 00:50
Representa os dados de um banco de dados como uma coleç? o de tabelas constituídas por um conjunto de atributos, que definem as propriedades ou características relevantes da entidade que representam. marque a alternativa que representa o modelo descrito no enunciado. escolha uma:
Answers: 3
question
Computers and Technology, 23.06.2019 14:00
Select the correct answer. a company is currently focusing on creating specific management goals for itself. which level of maturity is the company demonstrating under the sse_ccm framework? a. performed informally b. planned and tracked c. quantitatively controlled d. well-defined e. continuously improving
Answers: 2
You know the right answer?
Description:
In this assignment, you are asked to implement a dynamic programming algorithm fo...
Questions
question
Mathematics, 05.06.2020 02:58
question
Mathematics, 05.06.2020 02:58
question
English, 05.06.2020 02:58
question
Mathematics, 05.06.2020 02:58
question
Mathematics, 05.06.2020 02:58
question
Mathematics, 05.06.2020 02:58
question
Mathematics, 05.06.2020 02:58
Questions on the website: 13722360