ejake / algorithm_analysis

2 stars 9 forks source link

Bug in LCS #1

Closed juanpa097 closed 7 years ago

juanpa097 commented 7 years ago

In the implementation of the function lcs you are returning 2 things, the matrix and the size of the LCS. The matrix is correct but the answer is not correct. You are returning C[len(X) - 1,len(Y) - 1]. The positions len(X) - 1,len(Y) - 1 are not the right-bottom corner because the size of the matrix is len(X) + 1 by len(Y) + 1 because of the empty string character (""). Just return C[len(X),len(Y)], C

ejake commented 7 years ago

I agree with you Juan Pablo. I'll upgrade the notebook to fix the error.

Thank you for notice it.

On Mar 13, 2017 10:53 AM, "Juan Pablo Peñaloza Botero" < notifications@github.com> wrote:

In the implementation of the function lcs you are returning 2 things, the matrix and the size of the LCS. The matrix is correct but the answer is not correct. You are returning C[len(X) - 1,len(Y) - 1]. The positions len(X) - 1,len(Y) - 1 are not the right-bottom corner because the size of the matrix is len(X) + 1 by len(Y) + 1 because of the empty string character (""). Just return C[len(X),len(Y)], C

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ejake/algorithm_analysis/issues/1, or mute the thread https://github.com/notifications/unsubscribe-auth/AGTQRS2HxbSa5WRo38skuQuJyvdIIH30ks5rlWZ1gaJpZM4Mbch5 .