it looks you are talking about unlock 1 or 2 on spoj, use your own
recursive power function and since result may be very large so at
every stage take mod.
pow(a,b)
{
if(b==1)
return a;
else
{
if(b%2==0)
return (pow(a,b/2)%mod *pow(a,b/2)%mod) %mod
else
return pow(a,b/2)%mod *pow(a,b/2)%mod) %
Construct a recursive algorithm RedRootpath(x), which returns the number 1,
if the tree with the root x has a red rootpath. If such a path does not
exist, the algorithm will return 0.
Algorithm RedRootpath(x)
1: if (x = nil) then
2: return 0
3: else
4: if (x=RedRootpath)
5: return
Is this algorithm right or how shall I write it?
*
*
*
*
*Construct an algorithm **Intern(**x**)**, which returns the number of
internal nodes in the tree. *
* *
Algorithm Intern(x)
1: if (x = nil) then
2: return 0
3: else
4: return 1 + Intern(left[x]) + Intern(right[x])
5: en
couldn't understand the question ??
so we have been given a combination and ranking set
and set of cards ?
now if every time any one picks up 3/5/7, rating must be higher. seems
like a lot of randomness here.
Do we need to rearrange the cards. and how user is going to pickup the
card , from top, r
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at
ht