[R] beginner Q: hashtable or dictionary?

hadley wickham h.wickham at gmail.com
Mon Jan 30 18:00:30 CET 2006


> I would think that when translating from another language,
> it is best to write it in R in the simplest way, which probably
> means using a list.  Then if it turns out to be too slow, try doing
> something fancy.  I suspect that speed improvements are
> seldom necessary -- I can't believe how fast most computations
> are these days.

I totally agree.  However, if you are implementing an algorithm that
is O(n^2) when using a hash table that has O(1) updates, it is likely
to be at least O(n^3) when using a list with O(n) updates.  And
sometimes speed does matter!  (Although not as often as most people
think, and, of course, beware premature optimisation.)

Hadley




More information about the R-help mailing list