[algogeeks] Re: whats the fastest way to find the odd man out?

2007-01-17 Thread Satish
Got it.. basically i thought that 1. XOR at bit level is OK.. but for any number a, i was wondering what would ~a be.. (0?). But actually a XOR b would be nothing but their corresponding bitwise XORs. 2. Also, a XOR b = a. ~b + ~a.b. Thus if we expand the expression [a XOR b XOR c n

[algogeeks] Re: whats the fastest way to find the odd man out?

2007-01-16 Thread Satish
Hangjin Zhang wrote: Do an XOR on all numbers. The resulte is the number which occurs only once HZ On 12/30/06, Abhishek [EMAIL PROTECTED] wrote: Hi, Suppose I have a sequence of numbers in which every number occurs twice in the sequence except one. Whats the fastest way of finding that

[algogeeks] Re: whats the fastest way to find the odd man out?

2007-01-16 Thread Prunthaban Kanthakumar
XOR is the best computationally as well as space complexity. On 1/16/07, Satish [EMAIL PROTECTED] wrote: Hangjin Zhang wrote: Do an XOR on all numbers. The resulte is the number which occurs only once HZ On 12/30/06, Abhishek [EMAIL PROTECTED] wrote: Hi, Suppose I have a

[algogeeks] Re: whats the fastest way to find the odd man out?

2007-01-15 Thread Hangjin Zhang
Do an XOR on all numbers. The resulte is the number which occurs only once HZ On 12/30/06, Abhishek [EMAIL PROTECTED] wrote: Hi, Suppose I have a sequence of numbers in which every number occurs twice in the sequence except one. Whats the fastest way of finding that number which occurs only