XOR option wont work for floating points so being generic, using temp
variable is the best option for swapping.
Anyways, the question requirement was to swap without temp, hence above
given solutions go right.


On Mon, Nov 5, 2012 at 10:43 AM, atul anand <atul.87fri...@gmail.com> wrote:

> a=a^b;
> b=a^b;
> a=a^b;
>
> need to check if a and b are equal or not , bcozz a^a =0
>
> On Mon, Nov 5, 2012 at 2:02 AM, manish <narayan.shiv...@gmail.com> wrote:
>
>> Swapping two objects (not integers/chars),without using temp...?
>> my solution is using xor operation..is that right and ny other solutions
>> ?
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/algogeeks/-/OxVSnZ1QjzMJ.
>> 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
>> 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 algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
best wishes!!
 Vaibhav

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to