|
|
back to boardS - it is a line Create a matrix F[i][j] is a decision with i on j a symbol If S[i] it is a closing bracket, F[i][j] =1 + F[i+1][j] If S[i] a closing bracket that is two cases: 1) We add a closing bracket - 1 + min(F[i+1][k] + F[k+1][j]), where i<k<=j 2) Is in line closing - min(F[i+1][k-1], F[k+1][j]), where S[k] = S[i] and i<k<=j Interesting... But what you output? Please explain to me > 1) We add a closing bracket - 1 + min(F[i+1][k] + F[k+1][j]), where i<k<=j if we want to add a bracket we can add it in (i+1)position. and dont necessary too check all the kind. sorry for my poor english. GOOD LUCK!!! |
|
|