i tink logic which kamakshi gave is correct
code for same:::
#include
int max(int a,int b)
{
return (a>b?a:b);
}
int value(int a[],int l)
{
if(l<0)
return 0;
return max(a[l]+value(a,l-2),value(a,l-1));
}
int main()
{
int a[]={4,3,2,5,7,8};
printf("max::%d",value(
+1 dipankar
it shud be undefined
i tried in dev cpp, the output is
3 3 3
--
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
alg
@ankuj:
i think the solution is not correct..
could u please explain ur algo for
5,13,7,0,10,20,1,15,4,18
acc to ur algo answer is 2 but it should be 1(1-0)
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email
u will have to use similarity of triangles and area of parallelogram is base
* height
try it, u will reach the solution :)
--
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 un
its 2
--
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 a
sorry thats nt correct
--
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, v
6
--
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
h
i think logical address...physical address is never accessible to user
program
@amit-can u explain why??
--
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
suppose there is a binary tree and i am creating another tree which is same
as the previous one.
but while creating the new tree i am freeing the nodes of my old tree(i.e.,
i create one node in new tree and delete the corresponding node in old tree
and continue the process till the new tree is form
@Dave: awesome solution :):)
--
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 opti
@patro-
but that wont always give the right answer
suppose
length=breadth=3
and n=6
then acc to u a=1.22
and with that value u wont be able to accommodate 6 squares
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group
4
a+x(b+x(c+x(d+ex)))
--
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,
@Someshwar: precedence of && > ||
http://www.difranco.net/cop2220/op-prec.htm
--
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
alg
@khattri:thanks :) i thought it was correct.
--
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.co
O(n) solution:
odd_index=-1;
even_index=-1;
//now find first odd no.'s index
for(i=0;ihttp://groups.google.com/group/algogeeks?hl=en.
sorry the above algo will not work in case we have more than one single
element
--
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
al
take X-OR of all the elements.the one which has no duplicate will be
left and rest all will be reduced to zero.
--
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 unsubscrib
17 matches
Mail list logo