Re: [algogeeks] Re: unsorted array problem

2011-08-26 Thread raj kumar
@don really cool algo man -- 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

Re: [algogeeks] Re: unsorted array problem

2011-08-26 Thread tech coder
@ Don exactly waht u write i wanted to say On Fri, Aug 26, 2011 at 11:52 AM, tech coder wrote: > @Tech: I'm not sure I understand your algorithm. Let's try it on > {1,1,2,2,3,4,5,5,6,6,7,7}. The two number occurring an odd number of > times are 3 and 4. We xor the numbers getting 7 = 111 in binar

Re: [algogeeks] Re: unsorted array problem

2011-08-26 Thread tech coder
@Tech: I'm not sure I understand your algorithm. Let's try it on {1,1,2,2,3,4,5,5,6,6,7,7}. The two number occurring an odd number of times are 3 and 4. We xor the numbers getting 7 = 111 in binary. Now how do we divide the numbers into two groups? see we come to know that both number differ at bi

Re: [algogeeks] Re: unsorted array problem

2011-08-26 Thread Sanjay Rajpal
XOR all the elements in the array, the result will be the XOR of the two numbers occuring odd number of times. Now take any set bit of th result(u can determine the position of any bit set in the number). Divide the array such that for the numbers for which at this location(where the bit is set in