Let me explain a little more :-
For example :-
a^b = Can be written as (a^2)^(b/2) For n is even . [ Reason:- For
b/2 in my code or n=n>>1; in Rishabh code ]
= Can be written as a.(a^2)^(b-1/2) For n is odd [ Reason :-
x=(x*y) for the odd number for getting the alone ]
It works on this principle ..... Give it a try . In my code You just
have to substitute 'a' By a matrix . That will server the purpose ..
I hope you doubth wil be clear .. As said earlier work with the
numbers first then you will get the logic .
On Jul 19, 9:54 pm, SAMMM <[email protected]> wrote:
> The logic which I have posted , it works on that principle only . Take
> a good look . It is the standard way fopr finding the power of a
> number . (a^b)
>
> You take and example for a=3 and b=4 and test it in My posted code .
> then you will understand wht is happening .
>
> On Jul 19, 9:45 pm, snehi jain <[email protected]> wrote:
>
>
>
> > @Rishab Thanks ..
> > could you explain what your are doing in the function exp()..
>
> > On Tue, Jul 19, 2011 at 9:47 PM, Rishabh Maurya
> > <[email protected]>wrote:
>
> > > Yes its running fine at gcc 4.3.2 . And it might show warning in that
> > > case
> > > just change the name of the function exp().
>
> > > --
> > > 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.-Hide quoted text -
>
> > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -
--
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.