Re: [algogeeks] Que of Tejas Network

2011-08-28 Thread Anurag Narain
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(

Re: [algogeeks] Undefined behaviour for pointers to const values

2011-08-17 Thread Anurag Narain
+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

Re: [algogeeks] Re: find numbers whose difference is min

2011-08-16 Thread Anurag Narain
@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

Re: [algogeeks] Math Quiz

2011-08-11 Thread Anurag Narain
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

Re: [algogeeks] Math Quiz

2011-08-11 Thread Anurag Narain
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

Re: [algogeeks] Math Quiz

2011-08-11 Thread Anurag Narain
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

Re: [algogeeks] Math Quiz

2011-08-11 Thread Anurag Narain
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

Re: [algogeeks] Re: Printf

2011-08-05 Thread Anurag Narain
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

[algogeeks] Doubt

2011-08-03 Thread Anurag Narain
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

Re: [algogeeks] Re: Merging K-sorted lists using Heap

2011-08-02 Thread Anurag Narain
@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

Re: [algogeeks] Re: MS

2011-08-02 Thread Anurag Narain
@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

Re: [algogeeks] !!!!

2011-07-29 Thread Anurag Narain
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,

Re: [algogeeks] C output.

2011-07-26 Thread Anurag Narain
@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

Re: [algogeeks] Coding..........

2011-07-23 Thread Anurag Narain
@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

Re: [algogeeks] Coding..........

2011-07-22 Thread Anurag Narain
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.

Re: [algogeeks] How to remove duplicate element from array in one pass.

2011-06-02 Thread Anurag Narain
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

Re: [algogeeks] How to remove duplicate element from array in one pass.

2011-06-02 Thread Anurag Narain
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