An interesting fact about XOR:

a = 1
b = 2
a = a ^ b
b = a ^ b
a = a ^ b

The code above swaps 'a' and 'b' without the need of a third receipt.
Magic!

I'm sure this is pretty well known but in my case it really helped
clearing my sight on this matter.

The father of pragmatism (Charles S. Peirce) taught us his method: if
you want to learn about something you may use empirical methods to
understand its properties, how it behaves to stimuli, and so on. So my
advice is that if you want to understand XOR you should take a pen and
start playing with its properties. You can figure by yourself why it's
used in error checks perhaps.

Break a leg. :)

-- sav





On Jun 14, 3:22 am, snehi jain <snehijai...@gmail.com> wrote:
> hi,
>
> the way XOR operation works i.e 0 for duplicates is used the most.
> A practical application that i know is , XOR is used for Forward Error
> correction
> for packet loss over a network. It works on the same principle like the
> duplicate problem.
>
> Another application that i know is for Error detection of transmitted
> packets (which again works on the principle of duplicates).
>
> i hope it helps.
>
> Snehi
>
> On Tue, Jun 14, 2011 at 7:48 AM, Navneet Gupta <navneetn...@gmail.com>wrote:
>
>
>
>
>
>
>
> > Hello,
>
> > I would really appreciate if someone can help me get an intuitive
> > understanding of XOR over a range of numbers.
>
> > I have seen it's usage is a couple of problems where duplicates are
> > involved and though ultimately i can see how it is solving the problem, i
> > still feel like checking the correctness of the solution whenever i come
> > across such solutions.
>
> > Also would be good if someone can throw some light on what other kinds of
> > problems they have seen which are difficult(time complexity wise) but using
> > XOR gives an elegant and time efficient solution.
>
> > --Navneet
>
> >  --
> > 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.

-- 
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