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 agrawal <[email protected]> wrote:
> 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
> <[email protected]>wrote:
>
>> Masters Theorem
>> http://en.wikipedia.org/wiki/Master_theorem
>>
>>
>> On Thu, Jul 28, 2011 at 1:14 AM, NITIN SHARMA
>> <[email protected]>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 message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to [email protected].
>>> To unsubscribe from this group, send email to
>>> [email protected].
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>>
>>
>>
>> --
>> Regards
>> Rajeev N B <http://www.opensourcemania.co.cc>
>>
>> "*Winners Don't do Different things , they do things Differently"*
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Sunny Aggrawal
> B-Tech IV year,CSI
> Indian Institute Of Technology,Roorkee
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.