http://bugs.meego.com/show_bug.cgi?id=1007
--- Comment #11 from yongsheng <yongsheng.zhu(a)intel.com> 2010-05-26 20:14:37 PDT
---
I agree with your root cause analysis, but not with this solution. I
believe it
leads to accessing the cost value at index #-2, which falls of the lower end of
the array.
I don't think so. for i and j will never equal 0 when calculating
this
expression.
please see lcs.h:145.
145 if (i == 0 || j == 0) {
146 sub[i][j].choice = NONE;
147 sub[i][j].length = 0;
148 sub[i][j].cost = 0;
149 } else if (access.entry_at(a, i - 1) == access.entry_at(b, j -
1)) {
IMHO the cost function was called with correct indices. Basically
both one
before array and one after the end are valid and should give the same result as
the indices just inside the array.
I don't quite understand what the
'cost' is. but here, based on your
description, the first cost should be equal to the cost of second element
substract to that of the first element.
The implementation only handled index -1, but not index == size(). It
also did
not work for empty arrays.
Here's a more complete solution, committed to branch mbc1007_pohly. Yongsheng,
do you agree?
ok, please do.
--
Configure bugmail:
http://bugs.meego.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching someone on the CC list of the bug.