lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Sun, May 23, 2010 at 10:09 AM, Florian Weimer <fw@deneb.enyo.de> wrote:
>> Your definition requires an O(n) search to evaluate #x, whereas Lua's
>> definition allows an O(log n) search.
>
> Not really, you could use balanced binary trees or Judy trees, which
> would bring you down to O(log n).  On the other hand, I'm sure that
> the constants would be far worse than the current implementation.

and a reverse linked list could keep it at O(1); but all these assume
maintaining extra structure and keep it current on every assignment.

-- 
Javier