Re: [algogeeks] c code bst mirror prob

2011-07-14 Thread Anika Jain
ya guys m sorry actually swap code within the function is working ryt and swap code wasnt working ryt.. i did misunderstood sumthing.. @sandeep sir: thanku sir :) On Thu, Jul 14, 2011 at 11:26 AM, Sandeep Jain sandeep6...@gmail.comwrote: Your swap function is not correct. You are swapping p q

Re: [algogeeks] c code bst mirror prob

2011-07-14 Thread kavitha nk
ya i too think de same... //BE COOL// kavi -- 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

Re: [algogeeks] c code bst mirror prob

2011-07-14 Thread Anika Jain
ya i have posted na just nw i m sorry tht i misunderstood it.. swap code within the func is working ryt n swap func itself is working wrong.. On Thu, Jul 14, 2011 at 4:20 PM, kavitha nk kavithan...@gmail.com wrote: ya i too think de same... //BE COOL// kavi -- You received this

[algogeeks] c code bst mirror prob

2011-07-13 Thread Anika Jain
can some body tell me that: void swap(node *p,node *q) { node *t; t=p; p=q; q=t; } void mirror(node *p) { if (p==NULL) return; else {mirror(p-r); mirror(p-l); swap(p-r,p-l); } } in this the swapping is occuring but if i do : void

Re: [algogeeks] c code bst mirror prob

2011-07-13 Thread Piyush Kapoor
u need a pointer to a pointer to swap the pointers... On Thu, Jul 14, 2011 at 1:21 AM, Anika Jain anika.jai...@gmail.com wrote: can some body tell me that: void swap(node *p,node *q) { node *t; t=p; p=q; q=t; } void mirror(node *p) { if (p==NULL)

Re: [algogeeks] c code bst mirror prob

2011-07-13 Thread Piyush Sinha
Its working I guess in both the cases... On 7/14/11, Anika Jain anika.jai...@gmail.com wrote: can some body tell me that: void swap(node *p,node *q) { node *t; t=p; p=q; q=t; } void mirror(node *p) { if (p==NULL) return; else {mirror(p-r);

Re: [algogeeks] c code bst mirror prob

2011-07-13 Thread Anika Jain
by using swap function is pointer to a pointer used then?? On Thu, Jul 14, 2011 at 1:36 AM, Piyush Kapoor pkjee2...@gmail.com wrote: u need a pointer to a pointer to swap the pointers... On Thu, Jul 14, 2011 at 1:21 AM, Anika Jain anika.jai...@gmail.comwrote: can some body tell me that:

Re: [algogeeks] c code bst mirror prob

2011-07-13 Thread Anika Jain
n sorry i have wriiten it in c++ not c.. On Thu, Jul 14, 2011 at 1:44 AM, Anika Jain anika.jai...@gmail.com wrote: by using swap function is pointer to a pointer used then?? On Thu, Jul 14, 2011 at 1:36 AM, Piyush Kapoor pkjee2...@gmail.comwrote: u need a pointer to a pointer to swap the

Re: [algogeeks] c code bst mirror prob

2011-07-13 Thread Sandeep Jain
Your swap function is not correct. You are swapping p q locally. Since you are using c++, make the following changes. void swap*(node* p,node* q)* { node *t; t=p; p=q; q=t; } Regards, Sandeep Jain On Thu, Jul 14, 2011 at 1:45 AM, Anika Jain anika.jai...@gmail.com wrote: n