I can think of 2 methods if Hashing is not allowed.

1.  Plain comparison of every element with an other element, which takes
O(n2)

2.  We can sort the array, and the best we could achieve is O(nlogn) after
that use simple comparision,
like the code here : http://codepad.org/RtRbnyAN    ; Overall we can
optimize it best to O(n)
<http://codepad.org/RtRbnyAN>
Best Regards
Abhijit


On Sun, Feb 27, 2011 at 7:15 PM, Dave <dave_and_da...@juno.com> wrote:

> If hashing is disallowed, then I think the best method is to sort the
> data and check for consecutive triplicates. O(n log n).
>
> Dave
>
> On Feb 27, 6:35 am, bittu <shashank7andr...@gmail.com> wrote:
> > @Gaurav Hey I forgot to say Hashing is not allowed sum thing other
> > then this better solution
> >
> > @radha i don't think ur method works here chk out ur methodhttp://
> codepad.org/oTDNSoeu
> >
> > Thanks
> > Shashank
>
> --
> 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.
>
>

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