Btw how would your algo work if the numbers were ....

{ 1, 4, 5, 10^100 , 45, 5 }

I dont believe you can create an array of size 10^100.

This problem cannot be solved in better than O(nlgn).

-Dhyanesh

On 12/2/05, adak <[EMAIL PROTECTED]> wrote:

Hi pramod,

I'm not sure what the "right" name for this is, if anybody knows I hope
they jump in with that info for us.

In the original problem, the set of numbers contained just ONE
duplicate value. So let's say the set is { 3, 9, 6, 4, 4}

The array that is built up by the loop would then be have these values:

a[0]: 0  a[1]: 0  a[2]: 0  a[3]: 1  a[4]: 2  a[5]: 0 a[6]: 1 ... a[9]:
1.

I have a problem if you can't use tools like this: fast, elegant,
perfect for this job. I'm not saying a hammer is the only tool worth
keeping in the toolbox, but when you have a lot of wood that has to be
nailed together - why not use one, FCOL!

Good luck with your problem,
Dave


Reply via email to