Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Implement Matrix-Chain-Order in Java using two files, one tester and one class, by using the algorithm in the photo provided. There should be two types

Implement Matrix-Chain-Order in Java using two files, one tester and one class, by using the algorithm in the photo provided. There should be two types of data outputted:
1. The minimum number of scalar multiplications done.
2. The parenthesization of matrices. Example output of four matrices: A1(A2(A3A4)). Having parenthesis encasing the entire list of matrices is fine too, e.g.: (A1(A2(A3A4))) instead of A1(A2(A3A4)).
The list of matrices should be passed in through your tester. The matrices should each be 2-D. Also have a check to ensure that only valid matrix dimensions will be accepted. E.g. the following list of matrices are incompatible because the number of columns in A1 doesnt match the number of rows in A2:
A1 =5x20
A2 =30x40
A3 =40x50
The tester file should be used to test and demonstrate the capabilities of the class file. The tester would be used to pass in the list of matrices. Output should be the two items mentioned above. Your tester should not be reading from any external file and it shouldnt use command line as inputs.
image text in transcribed
MATRIX-CHAIN-ORDER (p) 1 -p.length -1 2 let m[1..n,1..n] and s[1..n -1,2..n] be new tables 3 for i - 1 to n 4 5 forl2 to n 6 // l is the chain length for i = l to n-1 -1 j-i1-1 mll, fork-i to j - 1 10 if q

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Security

Authors: Alfred Basta, Melissa Zgola

1st Edition

1435453905, 978-1435453906

More Books

Students also viewed these Databases questions

Question

internationalization of business?

Answered: 1 week ago