Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C > Re: cutting sti...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 2 Topic 26145 of 27678
Post > Topic >>

Re: cutting sticks problem

by James Dow Allen <jdallen2000@[EMAIL PROTECTED] > May 11, 2008 at 02:51 AM

On May 11, 3:49=A0pm, rossum <rossu...@[EMAIL PROTECTED]
> wrote:
> On Fri, 9 May 2008 03:48:20 -0700 (PDT), James Dow Allen
> <jdallen2...@[EMAIL PROTECTED]
> wrote:
> >the straightforward solution to this puzzle
> >is not of exponential complexity, but rather N^3/3.
>
> >I'm enclosing my source code (and cross-posting to
> >comp.lang.c) for critique.

> I think that you could use a better algorithm. =A0You are repeatedly
> calculating the cost of the same sticks as part of your subproblems.

No.  Reread the source to see that the code calculates and saves the
intermediate results exactly as you describe.  It is the caller of
bestcut()
rather than bestcut() itself that saves these results -- is that
where your confusion lies?

My algorithm is O(N^3).  Are your comments intended to suggest
existence of a less complex algorithm?

James
 




 2 Posts in Topic:
Re: cutting sticks problem
James Dow Allen <jdall  2008-05-11 02:51:38 
Re: cutting sticks problem
rossum <rossum48@[EMAI  2008-05-11 12:44:27 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Oct 11 18:38:49 CDT 2008.