Re: rosettacode 500 milestone passed

new topic     » goto parent     » topic index » view thread      » older message » newer message
Spock said...

I note the CPP version is described as "Initially taken from C but than fixed and refactored". Does that mean some subtle bug still lurks in the C version? The CPP version is also 3 times longer than the one in C. I didn't realise that "refactor" actually means to make longer.

I checked the history and found this: http://rosettacode.org/mw/index.php?title=Knapsack_problem/Bounded&diff=220921&oldid=219546

It seems the C++ version is based on a very different C version to the current one and hence that comment no longer applies.
I have added an appropriate comment to that page.

Still playing with the full-on recursive version, I've got an idea about caching ranges.
Right, I'm done: http://rosettacode.org/wiki/Knapsack_problem/Bounded#Range_cache_version
It should use less memory than the dp version, plus it can handle fractional weights.

Pete

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu