In constant space??? How? will you please elaborate?

On Thu, Aug 5, 2010 at 9:29 PM, dinesh bansal <bansal...@gmail.com> wrote:

> If I understand the question correctly... there is an array of size n which
> has n/2 distinct elements and one element is repeated n/2 times.
>
> For e.g.:
>    n = 4:   1 2 3 3
>    n = 6    1 2 3 4 4 4
>    n = 8    1 2 3 4 5 5 5 5
>
> So now this problem can be reduced to finding the first duplicate element
> in the array because remaining other elements will be unique. I think this
> can be done in 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 algoge...@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