Answer:
Follows are the code to this question:
MATRIX_CHAIN_MULTIPLY(A,s,i,j)//defining a method MATRIX_CHAIN_MULTIPLY that accepts 4 parameters
if(i == j)//use if block to check i and j value is equal
return A[i]//return array values
if(j == i+1)//use another if block to check j value is equal to incrementing value of i
return A[i]*A[j];//return multiplication of array
else//defining else block
x1 = MATRIX_CHAIN_MULTIPLY(A,s,i,S[i,j])//x1 variable to call above method
x2 = MATRIX_CHAIN_MULTIPLY(A,s,S[i,j]+1,j)//x2 variable to call above method
return B1*B2//return multiplication of method holding value
Explanation:
Please find the attached file of the complete question:
In the code, a method "MATRIX_CHAIN_MULTIPLY" is declared, which accepts parameters and uses a conditional statement to check value, which can be defined as follows: