See when u xor two same numbers, the result is 0. So as mentioned in the question, all numbers occur twice, so the result will be 0 for them and the one occuring once will be left(as 0 ^ number gives number itself). Hope u got Sanjay Kumar B.Tech Final Year Department of Computer Engineering National Institute of Technology Kurukshetra Kurukshetra - 136119 Haryana, India Contact: +91-8053566286, +91-9729683720
On Tue, Aug 16, 2011 at 10:07 PM, Anika Jain <anika.jai...@gmail.com> wrote: > i cudnt understand how is it done here by using xor by chen.. aftergetting > F it wud be the xor of of odd occuring elements, fine, then he wrote > if(xor)A1 ==0 how is this logic used?? > > > On Wed, Aug 17, 2011 at 8:17 AM, saurabh singh <saurab...@gmail.com>wrote: > >> +1 to dave.....xor is the way to go..... >> >> >> On Tue, Aug 16, 2011 at 7:06 PM, Dave <dave_and_da...@juno.com> wrote: >> >>> @Raghavan: But aren't maps implemented as binary search trees? That >>> would make insertion and searching O(log n), and the overall operation >>> O(n log n). >>> >>> Dave >>> >>> On Aug 16, 4:08 am, Raghavan <its...@gmail.com> wrote: >>> > @sukran: >>> > If you were asking for the map based solution >>> > >>> > space and time complexity would be o(n). >>> > >>> > On Tue, Aug 16, 2011 at 2:34 PM, sukran dhawan <sukrandha...@gmail.com >>> >wrote: >>> > >>> > >>> > >>> > >>> > >>> > > what is the complexity in which it has been done ? >>> > >>> > > On Tue, Aug 16, 2011 at 1:41 PM, MAC <macatad...@gmail.com> wrote: >>> > >>> > >> Given an array of integers. Each number in the array repeats ODD >>> number of >>> > >> times, but only 1 number repeated for EVEN number of times. Find >>> that >>> > >> number. >>> > >>> > >> -- >>> > >> thanks >>> > >> --mac >>> > >>> > >> -- >>> > >> 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. >>> > >>> > -- >>> > Thanks and Regards, >>> > Raghavan KL >>> >>> -- >>> 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. >>> >>> >> >> >> -- >> Saurabh Singh >> B.Tech (Computer Science) >> MNNIT ALLAHABAD >> >> >> -- >> 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. > -- 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.