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: converting ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 6 of 6 Topic 26166 of 26972
Post > Topic >>

Re: converting recursive function to iterative

by Ben Bacarisse <ben.usenet@[EMAIL PROTECTED] > May 13, 2008 at 03:08 PM

V <vishal.study@[EMAIL PROTECTED]
> writes:

> Mistyped one thing (shown as CORRECTION below)...but still doesn't
> work ;-(

Did you follow Spiros Bousbouras advice?

The recursive version does this:

i=0 return V
i=1 return mul(mp(V,0,c),c) i.e. mul(V,c)
i=2 return mul(mp(V,1,c),c) i.e. mul(mul(V,c),c)
i=3 return mul(mp(V,2,c),c) i.e. mul(mul(mul(V,c),c),c),c)

You need to repeatedly apply mul to V which is not what your code
does.

-- 
Ben.
 




 6 Posts in Topic:
converting recursive function to iterative
V <vishal.study@[EMAIL  2008-05-11 04:21:27 
Re: converting recursive function to iterative
Spiros Bousbouras <spi  2008-05-11 04:45:04 
Re: converting recursive function to iterative
V <vishal.study@[EMAIL  2008-05-12 18:54:44 
Re: converting recursive function to iterative
V <vishal.study@[EMAIL  2008-05-12 19:04:48 
Re: converting recursive function to iterative
CBFalconer <cbfalconer  2008-05-13 00:04:05 
Re: converting recursive function to iterative
Ben Bacarisse <ben.use  2008-05-13 15:08:44 

Post A Reply:
  Go here to Signup

AddThis Feed Button


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

Contact
tan12V112 Fri Jul 25 16:04:14 CDT 2008.