Page 3 of 3

Posted: Fri Jun 17, 2005 4:11 pm
by misof
Well.. are you sure that the code is correct? (I.e. compiler problems only?) I don't have the time to check the whole problem statement and to understand each piece of the posted code, but he declared two maps and used only one of them -- the same map was used in both functions. This may be a bug. After I changed the map used in the second function from m to h, the code worked even with g++-2.95. Wasn't this the source of all the problems?

Posted: Fri Jun 17, 2005 5:59 pm
by chunyi81
You may be right misof.

I actually tried changing part of the compute function to

int temp = myg(n);
m[n] = temp;
return m[n];

And this worked with g++ 2.95 also. I did notice that he used two maps and h was not used at all. I am also wondering why this happens.