Re: [algogeeks] swapping 2 variables without using temporary variables

2011-07-29 Thread tech rascal
yeah thanxgot it this won't work if memory locations of both variables is same On Fri, Jul 29, 2011 at 1:03 PM, Prem Krishna Chettri wrote: > http://en.wikipedia.org/wiki/XOR_swap_algorithm > > Answer as well as broaden you guys Concept on Memory.. > > Have a look > > > On Fri, Jul 29, 2011

Re: [algogeeks] swapping 2 variables without using temporary variables

2011-07-29 Thread Prem Krishna Chettri
http://en.wikipedia.org/wiki/XOR_swap_algorithm Answer as well as broaden you guys Concept on Memory.. Have a look On Fri, Jul 29, 2011 at 12:54 PM, tech rascal wrote: > can u give an explanation for ...how xor method fails for same values?? > I think it will work right... > > > On Fri, Jul 29,

Re: [algogeeks] swapping 2 variables without using temporary variables

2011-07-29 Thread tech rascal
can u give an explanation for ...how xor method fails for same values?? I think it will work right... On Fri, Jul 29, 2011 at 12:26 PM, Prem Krishna Chettri wrote: > Replying to all the Above Code. > > 1> XOR operation to swap variable are not a solution as it fails for > swapping of same value r

Re: [algogeeks] swapping 2 variables without using temporary variables

2011-07-28 Thread Prem Krishna Chettri
Replying to all the Above Code. 1> XOR operation to swap variable are not a solution as it fails for swapping of same value results 0. 2> the Short and Sweet looking various modification of code fails to swap data when U swap data between two different data type. So I suggest you all guys to us

Re: [algogeeks] swapping 2 variables without using temporary variables

2011-07-28 Thread tech rascal
@reynald: this won't work for floatsis there any other case u can think of, where this method won't work?? 2011/7/29 A for ♥ღAakasHღ♥ > > a=(a+b)-(b=a); > > > *Aakash Abhishek Pradhan** > **MCA Final Year, > NIT Durgapur* > > -- > You received this message because you are subscribed to

Re: [algogeeks] swapping 2 variables without using temporary variables

2011-07-28 Thread A for ♥ღAakasHღ♥
a=(a+b)-(b=a); *Aakash Abhishek Pradhan** **MCA Final Year, NIT Durgapur* -- 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 algoge

Re: [algogeeks] swapping 2 variables without using temporary variables

2011-07-28 Thread Reynald Suz
Try this out, Venkat a^=b^=a^=b; (XORing) On Fri, Jul 29, 2011 at 11:09 AM, tech rascal wrote: > one method is- > a=a+b; > b=a-b; > a=a-b; > > is there any other method??? > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to t

[algogeeks] swapping 2 variables without using temporary variables

2011-07-28 Thread tech rascal
one method is- a=a+b; b=a-b; a=a-b; is there any other method??? -- 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+unsubs