[algogeeks] recursion

2011-04-15 Thread priya mehta
http://www.ideone.com/PmJ7A -- 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

[algogeeks] Re: recursion

2011-04-15 Thread priya mehta
http://www.ideone.com/IKM57 http://www.ideone.com/PmJ7A there is a minor change between the codes one works another doesn't someone please tell the reason On Fri, Apr 15, 2011 at 8:38 PM, priya mehta priya.mehta...@gmail.comwrote: http://www.ideone.com/PmJ7A -- You received this message

Re: [algogeeks] Re: recursion

2011-04-15 Thread priya mehta
if statement is checked against ba whereas in 2nd case a is not modified and checkd with the same value for the second if statement On Fri, Apr 15, 2011 at 8:39 PM, priya mehta priya.mehta...@gmail.comwrote: http://www.ideone.com/IKM57 http://www.ideone.com/PmJ7A there is a minor

Re: [algogeeks] Amazon Question

2011-04-13 Thread priya mehta
i hope all the cousins means all the nodes on the same level, so it should be done using level order traversal. On Thu, Apr 14, 2011 at 8:38 AM, sravanreddy001 sravanreddy...@gmail.comwrote: Yes, this is correct, and to move the data in the array, its simple, just do a traverse and populate

Re: [algogeeks] Re: Amazon Question

2011-04-13 Thread priya mehta
is to go up two levels (to the grandparent) and descend to the other child (to an aunt or uncle). The children of that node are the cousins. Dave On Apr 13, 11:13 pm, priya mehta priya.mehta...@gmail.com wrote: i hope all the cousins means all the nodes on the same level, so it should be done

Re: [algogeeks] no of occurance in two square matrix

2011-04-13 Thread priya mehta
i think kmp in 2-D can help. On Fri, Apr 8, 2011 at 10:33 PM, RIDER mohit...@gmail.com wrote: if there is a matrix A[][] of order m and another matrix B[][] of order n such that (mn) you have to find the occurance of matrix B[][] in matrix A[][]. A[5][5]=1,2,3,4,5 5,4,1,9,7 2,1,7,3,4

Re: [algogeeks] power of 2

2011-03-20 Thread priya mehta
floor (log2 (a)) On Sun, Mar 20, 2011 at 2:13 PM, cegprakash cegprak...@gmail.com wrote: given a how to find the maximum value of n if 2^n a -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to

Re: [algogeeks] Re: binary search for Linked List?

2011-03-11 Thread priya mehta
: what is skip list On Fri, Mar 11, 2011 at 5:58 AM, priya mehta priya.mehta...@gmail.com wrote: use skip list:) On Thu, Mar 10, 2011 at 2:31 PM, ravi teja ravitejal...@gmail.com wrote: @Utkarsh : Yeah , that is when you can access any element in O(1) time

Re: [algogeeks] binary search for Linked List?

2011-03-10 Thread priya mehta
use skip list:) On Thu, Mar 10, 2011 at 2:31 PM, ravi teja ravitejal...@gmail.com wrote: @Utkarsh : Yeah , that is when you can access any element in O(1) time and the elements are sorted.This happens in a sorted array where you get an overall complexisty of O(logn). -- You received

Re: [algogeeks] printing without loop

2011-03-01 Thread priya mehta
This is awesome On Tue, Mar 1, 2011 at 1:27 PM, sunny agrawal sunny816.i...@gmail.comwrote: int i=1; #define PRINT1 couti++endl; #define PRINT2 PRINT1 PRINT1 #define PRINT4 PRINT2 PRINT2 #define PRINT8 PRINT4 PRINT4 #define PRINT16 PRINT8 PRINT8 #define PRINT32 PRINT16 PRINT16

Re: [algogeeks] printing without loop

2011-03-01 Thread priya mehta
@sunny This is awesome On Tue, Mar 1, 2011 at 6:25 PM, priya mehta priya.mehta...@gmail.comwrote: This is awesome On Tue, Mar 1, 2011 at 1:27 PM, sunny agrawal sunny816.i...@gmail.comwrote: int i=1; #define PRINT1 couti++endl; #define PRINT2 PRINT1 PRINT1 #define PRINT4 PRINT2

[algogeeks] The C Programming Language, 2nd edition, Kernighan and Ritchie Solutions

2011-02-06 Thread priya mehta
Someone please share The C Programming Language, 2nd edition, Kernighan and Ritchie Solutions -- 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

[algogeeks] what will be the output

2011-02-05 Thread priya mehta
#include stdio.h #define PrintInt(expr) printf(%s : %d\n,#expr,(expr)) *int* FiveTimes(*int* a) { *int* t; t *=* a**2 *+* a; *return* t; } *int* main() { *int* a *=* 1, b *=* 2,c *=* 3; PrintInt(FiveTimes(a)); PrintInt(FiveTimes(b));

Re: [algogeeks] what will be the output

2011-02-05 Thread priya mehta
...@gmail.comwrote: because u not thinking of operator precedence :P :P On Sat, Feb 5, 2011 at 2:52 PM, priya mehta priya.mehta...@gmail.comwrote: why is this happening? On Sat, Feb 5, 2011 at 2:51 PM, Manmeet Singh mans.aus...@gmail.comwrote: 8, 32, 96 On Sat, Feb 5, 2011 at 2:46 PM

[algogeeks] what will be the output

2011-02-04 Thread priya mehta
#include stdio.h #define f(a,b) a*##*b #define g(a) *#*a #define h(a) g(a) *int* main() { printf(%s\n,h(f(1,2))); printf(%s\n,g(f(1,2))); *return* 0; } -- You received this message because you are subscribed to the Google Groups Algorithm Geeks

Re: [algogeeks] what will be the output

2011-02-04 Thread priya mehta
thats amazing :) :) but i wanted to know the explanation dear. On Sat, Feb 5, 2011 at 12:49 AM, rajat ahuja catch.rajatah...@gmail.comwrote: 12 and f(1,2) On Sat, Feb 5, 2011 at 12:46 AM, priya mehta priya.mehta...@gmail.comwrote: #include stdio.h #define f(a,b) a*##*b #define g

Re: [algogeeks] Amazon Written Test Q1

2011-02-03 Thread priya mehta
if you know the range then you can use something like count sort, but as here nothing is mentioned you have to take at least O(nlogn) time as the lower bound of comparision sort is O(nlogn) On Sun, Jan 30, 2011 at 6:10 PM, bittu shashank7andr...@gmail.com wrote: Sort the Doubly Linked List..In

[algogeeks] floating point

2011-01-08 Thread priya mehta
#includestdio.h int main() { float a=275.7; if(275.7a) printf(Hi); else printf(Hello); return 0; } #includestdio.h int main() { float a=75.7; if(75.7a) printf(Hi); else printf(Hello); return 0; } why the above two programs give different output? -- You received this message

Re: [algogeeks] Re: floating point

2011-01-08 Thread priya mehta
. By the way, on my machine it outputs the same thing(Hello) e.g. #define epsilon 10e-6 if(275.7-aepsilon) printf(HI); else printf(Hello); On Jan 8, 9:24 pm, priya mehta priya.mehta...@gmail.com wrote: #includestdio.h int main() { float a=275.7; if(275.7a) printf(Hi

Re: [algogeeks] Re: floating point

2011-01-08 Thread priya mehta
down to form the float and the other is less than the float because the double is rounded up to form the float. Dave On Jan 8, 8:24 pm, priya mehta priya.mehta...@gmail.com wrote: #includestdio.h int main() { float a=275.7; if(275.7a) printf(Hi); else printf(Hello

[algogeeks] post and pre increment operators

2011-01-08 Thread priya mehta
int a=2; printf(%d %d %d,a,a,a++); the output is 3 3 2 can someone tell the logic behind this? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group,

Re: [algogeeks] post and pre increment operators

2011-01-08 Thread priya mehta
, Kartheek. On Sun, Jan 9, 2011 at 10:38 AM, priya mehta priya.mehta...@gmail.comwrote: int a=2; printf(%d %d %d,a,a,a++); the output is 3 3 2 can someone tell the logic behind this? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group

Re: [algogeeks] post and pre increment operators

2011-01-08 Thread priya mehta
the same approach On Sun, Jan 9, 2011 at 11:06 AM, priya mehta priya.mehta...@gmail.comwrote: @kartheek so does it use stack for that? On Sun, Jan 9, 2011 at 11:03 AM, priya mehta priya.mehta...@gmail.comwrote: ok i got that On Sun, Jan 9, 2011 at 11:01 AM, kartheek muthyala kartheek0

Re: [algogeeks] Re: post and pre increment operators

2011-01-08 Thread priya mehta
is from right to left !!!, Regards Sundi On Jan 9, 10:08 am, priya mehta priya.mehta...@gmail.com wrote: int a=2; printf(%d %d %d,a,a,a++); the output is 3 3 2 can someone tell the logic behind this? -- You received this message because you are subscribed

Re: [algogeeks] Re: post and pre increment operators

2011-01-08 Thread priya mehta
http://www.ideone.com/mxvmt please see please see the link it has the program with output On Sun, Jan 9, 2011 at 11:44 AM, Harshal hc4...@gmail.com wrote: hey i am also getting the output as 12,13,13,13.. -- You received this message because you are subscribed to the Google Groups

Re: [algogeeks] quick sort

2011-01-05 Thread priya mehta
You can't make it deterministically run in O(nlogn). On Wed, Jan 5, 2011 at 1:25 PM, lee steath...@gmail.com wrote: how can we make quick sort to run in O(logn) time in worst case?? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post