943,150 Members | Top Members by Rank

Ad:
Feb 6th, 2010
0

time complexity of pow and equation solver

Expand Post »
hi everyone.i'm just wondering what the time complexity of the fastest pow function you know of,in the general case i.e when it's parameters are real numbers .Heard someone say it is virtually constant.Also whats the likely complexity of the most efficient algorithm that finds the derivative of a function of order n,at a given point.Thanks for every reply
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
joshuabraham is offline Offline
8 posts
since May 2008
Feb 6th, 2010
0
Re: time complexity of pow and equation solver
For powers of two all you have to do is use the shifter, which is very
fast and is probably almost constants for the usual powers of 2.

For ordinary numbers, its probably the O(exp), where exp is the
exponent. For example, base^exp, to calculate that it would probably take exp times to multiply base to get the answer.

The above is not definite, its just a hunch.
Reputation Points: 840
Solved Threads: 594
Senior Poster
firstPerson is offline Offline
3,859 posts
since Dec 2008
Feb 6th, 2010
0
Re: time complexity of pow and equation solver
For ordinary numbers, its probably the O(exp), where exp is the
exponent. For example, base^exp, to calculate that it would probably take exp times to multiply base to get the answer.
It is at worst O(log(exp)). For example:
^2: x*x
^4: x2 = x*x, x^4 = x2 * x2
^8: x2 = x*x, x4 = x2*x2, x^8 = x4 * x4
etc.

In the general case, the multiplication schedule is a bit hairy (and finding the best one is probably NP-hard).

PS: this is assuming that a multiplication itself has a constant complexity, which is definitely wrong.
Last edited by nezachem; Feb 6th, 2010 at 5:33 pm.
Reputation Points: 707
Solved Threads: 185
Practically a Posting Shark
nezachem is offline Offline
843 posts
since Dec 2009
Feb 6th, 2010
0

thanks for the info

thanks for the info guys
Reputation Points: 10
Solved Threads: 0
Newbie Poster
joshuabraham is offline Offline
8 posts
since May 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Computer Science Forum Timeline: sscanf fucntion
Next Thread in Computer Science Forum Timeline: Search Algorithms





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC