@anirvana: Your solution works for the case when all elements except 1 are repeated twice. Here only once element is repeated twice.
On 10/6/10, Dave <[email protected]> wrote: > @Anirvana: Please demonstrate how your algorithm works on the data 1, > 2, 2, 3, 5. > > Dave > > On Oct 6, 7:25 am, Anirvana Mishra <[email protected]> wrote: >> It can be done in linear time. >> Simply take the XOR of all the elements of the array and you have the >> answer now ;) >> >> On Oct 6, 4:08 pm, tech rascal <[email protected]> wrote: >> >> >> >> > can u do dis problem in linear time, o(n)?? >> >> > On Wed, Oct 6, 2010 at 4:20 PM, Mukesh Gupta >> > <[email protected]>wrote: >> >> > > Keep inserting elements in a binary search tree and break once you get >> > > the find the element in the tree. >> > > Complexity=O(n log n) >> >> > > On 10/5/10, sourav <[email protected]> wrote: >> > > > You are given an array of positive numbers in which one number is >> > > > repeated. Rest all are present only once. Find the duplicate number >> > > > in >> > > > linear or sub linear time. >> >> > > > -- >> > > > You received this message because you are subscribed to the Google >> > > > Groups >> > > > "Algorithm Geeks" group. >> > > > To post to this group, send email to [email protected]. >> > > > To unsubscribe from this group, send email to >> > > > [email protected]<algogeeks%2bunsubscr...@googlegroups >> > > > .com> >> > > . >> > > > For more options, visit this group at >> > > >http://groups.google.com/group/algogeeks?hl=en. >> >> > > -- >> >> > > Mukesh Gupta >> > > Delhi College of Engineering >> >> > > -- >> > > You received this message because you are subscribed to the Google >> > > Groups >> > > "Algorithm Geeks" group. >> > > To post to this group, send email to [email protected]. >> > > To unsubscribe from this group, send email to >> > > [email protected]<algogeeks%2bunsubscr...@googlegroups >> > > .com> >> > > . >> > > For more options, visit this group at >> > >http://groups.google.com/group/algogeeks?hl=en.- Hide quoted text - >> >> - Show quoted text - > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > > -- Mukesh Gupta Delhi College of Engineering -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
