Hi Inserting into BST and break on same element will detect duplicates. But in any case, this is still O(2n) ? - once for inserting them in to the tree and another for the inorder read.
Correct me if wrong. Rgds Supraja J On Thu, Jun 2, 2011 at 1:11 PM, Harshal <[email protected]> wrote: > @Anurag: XOR wont work here, 1 element is repeated, not 1 element is > unique. Read the question again. > > Keep inserting elements in a BST and break once you find the same element. > O(nlogn) > > > On Fri, Jun 3, 2011 at 12:38 AM, Anurag Narain <[email protected]>wrote: > >> take X-OR of all the elements.....the one which has no duplicate will be >> left and rest all will be reduced to zero. >> >> -- >> 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. >> > > > > -- > Harshal Choudhary, > III Year B.Tech CSE, > NIT Surathkal, Karnataka, India. > > > -- > 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. > -- U -- 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.
