no the array is unsorted.. 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. > > > > On Thu, Aug 5, 2010 at 7:06 PM, AlgoBoy <manjunath.n...@gmail.com> wrote: > >> an array in which n/2 elements are unique...and the remaning n/2 have >> the same elements but reapeated n/2 times. can anyone suggest a linear >> solution with constant space/... >> >> -- >> 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<algogeeks%2bunsubscr...@googlegroups.com> >> . >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> >> > > > -- > Dinesh Bansal > The Law of Win says, "Let's not do it your way or my way; let's do it the > best way." > > -- > 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<algogeeks%2bunsubscr...@googlegroups.com> > . > 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 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.