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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 14:00, allison9746
Need ! will choose brainliest! discuss the role of abstraction in the history of computer software.
Answers: 1
image
Computers and Technology, 24.06.2019 13:00, angelynb1497
Your mom wants to purchase a laptop computer. she said she wants her new computer to be able to play her dvds so she can listen to music and wants to know what type of optical drives will play her disk. which type of drive should she look for?
Answers: 1
image
Computers and Technology, 25.06.2019 04:20, mjam85877
Many prestigious universities have a system called a “legacy preference system” which is used to decide which applicants should be accepted to the university. if an applicant’s parent is an alumnus of the university, the applicant will be admitted with lower gpa and sat scores than if the parent is not an alumnus. (there is currently a lot of discussion about the fairness of this system, but universities get a lot of money from their alumni so they are unwilling to change ) your assignment for mp2 is to implement a computerized system like this for a very small prestigious university. the university has two schools, liberal arts and music, each with their own criteria for accepting students. your program must read in certain information about an applicant and print a message saying whether the applicant should be accepted or not.
Answers: 2
image
Computers and Technology, 25.06.2019 05:30, salllllllllll
In our new car, we were able to drive 30 miles in a half an hour. from this information, we can determine the car's a. acceleration. b. velocity. c. speed. d. direction.
Answers: 1
You know the right answer?
Description:
In this assignment, you are asked to implement a dynamic programming algorithm fo...

Questions in other subjects:

Konu
Mathematics, 17.06.2021 18:30