Package com.zybooks.dsaj.text
Class MatrixChain
java.lang.Object
com.zybooks.dsaj.text.MatrixChain
Demonstration of dynamic programming.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic int[][]
matrixChain
(int[] d) Returns an n-by-n matrix such that N[i][j] represents the minimum number of multiplications to compute the product of matrix chain product Ai through Aj inclusive.
-
Constructor Details
-
MatrixChain
public MatrixChain()
-
-
Method Details
-
matrixChain
public static int[][] matrixChain(int[] d) Returns an n-by-n matrix such that N[i][j] represents the minimum number of multiplications to compute the product of matrix chain product Ai through Aj inclusive. The parameter d is an array of n+1 numbers, such that the size of the kth matrix is d[k]-by-d[k+1].
-