Only possible best solution seems to be sorting the array using median selection algorithm ( a varient of quicksort) and then comparing to find the elements.
Cheers, Ankit!!! On Thu, Nov 24, 2011 at 11:32 AM, kumar raja <[email protected]> wrote: > In the given array all the elements occur single time except one element > which occurs 2 times find it in O(n) time and O(1) space. > > e.g. 2 3 4 9 3 7 > > output :3 > > If such a solution exist can we extend the logic to find "All the repeated > elements in an array in O(n) time and O(1) space" > > > > -- > Regards > Kumar Raja > M.Tech(SIT) > IIT Kharagpur, > [email protected] > > -- > 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.
