I found this while looking up problems on dynamic programming. You are given an unparanthesized expression of the form V0 O0 V1 O1 .... Vn-1
We have to put brackets at places which maximizes the value of the entire expression.
V's are the operands and O's are the operators. In the first version of problem operators can be * and + and operands are positive. Second version of problem is completely general.
For the first version i came up with DP solution .
Solution - A[] = operands array B[] - operators array T(A[i,j]) - max value of expression T(A[0,n-1]) = max over all i {(T(A[0,i]) Oi T(A[i+1,n-1]))}
The boundary cases are trivial (when i = j). I need help with the following - Analyze the running time of this algorithm. And if there exists a better one.