Time complexity:
int get_power(int a, int b)
{
if(!b) return 1;
if(b%2) return a * get_power(a, b/2);
return get_power(a, b/2);
}
int func(int p)
{
int sum = 0;
for(int i = 1; i <= p; ++i) {
sum += get_power(i, 5);
}
return sum;
}
O(plgp) or O(plg5)..? or anything else..?
On 7/28/11, sunny agra
Masters' Theorem can be applied only to Divide and Conquer kind of alogs. I
would suggest you to read the initial few chapters of "Introduction to
Algorithms" by Cormen.
Regards
On 28 July 2011 01:16, rajeev bharshetty wrote:
> Masters Theorem
> http://esudo apt-get install
> python-lxmln.wiki
Master theorem can be used when we know the recurrence relation.
You can read the 2nd Chapter of CLRS..
On Thu, Jul 28, 2011 at 1:16 AM, rajeev bharshetty wrote:
> Masters Theorem
> http://en.wikipedia.org/wiki/Master_theorem
>
>
> On Thu, Jul 28, 2011 at 1:14 AM, NITIN SHARMA wrote:
>
>
Masters Theorem
http://en.wikipedia.org/wiki/Master_theorem
On Thu, Jul 28, 2011 at 1:14 AM, NITIN SHARMA wrote:
> Can anybody explain the basic steps that how to calculate the
> complexity of an algo so that i would be able to find complexity of
> any program
>
> --
> You received this messa
Can anybody explain the basic steps that how to calculate the
complexity of an algo so that i would be able to find complexity of
any program
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@g