You don't actually have to do the first round, setting all the elements of T to 0. Adding 1 to an empty value seems to work fine, in my experience.

best,

Mark

On 12 Jul 2006, at 12:40, jbv wrote:

Hi again,

I have some data that I need to process repeatedly and as
fast as possible.

first I have a variable V with numeric values > 0 (1 per line)
and some of them can repeat themselves in the list.

then, I need to build and array T in which keys are those numeric
values, and the data associated to each key is the number of times
each value appears in the list.

for instance, if V contains :
    2
    2
    2
    4
    4

then, T contains :
    T[2]=3
    T[4]=2

I came up with some brute force loops :

  put "" into T
  repeat for each line j in V
   put 0 into T[j]
  end repeat
  repeat for each line j in V
   add 1 to T[j]
  end repeat

but was wondering if it could be done even faster...
note : the original list of values can be pretty large (> 30000)...

Thanks,
JB

_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to