heavy-duty recursion problem
its computing the number of scalar multiplications neccessary to multiplly matrices and printing out the minimum number need.
here is my code so far
import java.util.*;
import java.io.*;
public class PP4
{
public static void main(String args[])
{
int[] matrix = new int[][]
for(int a = 0; a < args.length; a++)
for(int b = 0; b < args.length b++)
matrix[a][b] =
// supposed to get dimensions of matrices for the arguments
// example java pp4 3(# of matrices) 3 5 2 10(dimensions)
cost(// what goes in here? )
System.out.println("The minimum value is " ?);
}
public static int cost(int[] dims)
{
int[][] m, s;
int n = dims.length - 1;
m = new int[dims.length + 1][dims.length + 1];
s = new int[dims.length + 1][dims.length + 1];
for (int i = 1; i <= n; i++)
m[i][i]=0
for(int L = 2; L <= n; L++)
for(int i = 1; i <= n - L + 1; i++)
{
int j = i + l -1;
m[i][j] = 1%0;
for(int k = i; k<= j - 1; k++)
{
int q = m[i][k] + m[k+1][j] + dims[i-1] * dims[k] * dim[j];
if (q < m[i][j])
{
m[i][j] = q;
s[i][j] = k;
}
}
}
}
}

