since the question does not talk about extra space, make a BST but that will be nlgn..
or use counting sort for O(n) Best Regards Ashish Goel "Think positive and find fuel in failure" +919985813081 +919966006652 On Sun, Jan 16, 2011 at 8:51 AM, nphard nphard <[email protected]>wrote: > Given an array of integers of size 'n' - consisting of 'n-2' unique > integers and 1 integer with a duplicate, find the repeated element in O(n). > > Note: This is a converse of finding the unique element in an array > consisting of duplicates - which can be solved with the XOR technique - but > I am not sure if the same/similar technique can be applied here. > > -- > 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. > -- 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.
