@Sachin: You can sort the array in O(n log n), and then finding the
two numbers is an additional O(n), so the resulting complexity is O(n
log n).

Dave

On Aug 25, 2:01 pm, sachin sabbarwal <algowithsac...@gmail.com> wrote:
> We have an array which contains integer numbers (not any fixed range). Only
> two numbers are repeated odd number of times and remaining even number of
> times. Find the 2 numbers.
>
> like
>
> arr[]={1,2,5,1,5,1,1,3,2,2}
>
> 1 -> 4 times(even)
> 2-> 3 times(odd)
> 3-> 1 times(odd)
> 5-> 2 times(even)
>
> output 2 3
>
> m not able to come up with a non-hashing solution which is faster than n^2,
> plz suggest both type of solutions viz. hashing and non-hashing one's.

-- 
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.

Reply via email to