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 <[email protected]>wrote: > 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 <[email protected]>wrote: > >> n sorry i have wriiten it in c++ not c.. >> >> >> On Thu, Jul 14, 2011 at 1:44 AM, Anika Jain <[email protected]>wrote: >> >>> by using swap function is pointer to a pointer used then?? >>> >>> >>> On Thu, Jul 14, 2011 at 1:36 AM, Piyush Kapoor <[email protected]>wrote: >>> >>>> u need a pointer to a pointer to swap the pointers... >>>> >>>> >>>> On Thu, Jul 14, 2011 at 1:21 AM, Anika Jain <[email protected]>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); >>>>> mirror(p->l); >>>>> swap(p->r,p->l); >>>>> } >>>>> } >>>>> >>>>> in this the swapping is occuring but if i do : >>>>> >>>>> void mirror(node *p) >>>>> { >>>>> if (p==NULL) >>>>> return; >>>>> >>>>> else >>>>> { mirror(p->r); >>>>> mirror(p->l); >>>>> node *t; >>>>> t=p->r; >>>>> p->r=p->l; >>>>> p->l=t; >>>>> } >>>>> } >>>>> >>>>> >>>>> here it is not getting done .. why?? >>>>> >>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "Algorithm Geeks" group. >>>>> To post to this group, send email to [email protected]. >>>>> To unsubscribe from this group, send email to >>>>> [email protected]. >>>>> For more options, visit this group at >>>>> http://groups.google.com/group/algogeeks?hl=en. >>>>> >>>> >>>> >>>> >>>> -- >>>> *Regards,* >>>> *Piyush Kapoor,* >>>> *CSE-IT-BHU* >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Algorithm Geeks" group. >>>> To post to this group, send email to [email protected]. >>>> To unsubscribe from this group, send email to >>>> [email protected]. >>>> For more options, visit this group at >>>> http://groups.google.com/group/algogeeks?hl=en. >>>> >>> >>> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
