[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Lua 5.1 (work1) now available
- From: Mark Hamburg <mhamburg@...>
- Date: Thu, 02 Sep 2004 07:42:53 -0700
Does this affect the time for table.remove( myTable ) which I thought used
to be O(1) once n had been identified?
on 9/2/04 7:29 AM, Roberto Ierusalimschy at firstname.lastname@example.org wrote:
>> That is, 'table.getn' returns the _last_ integer index, and not the
>> last before 'nil'.
> The new getn returns any integer index before a nil. If the array is
> properly formatted (no "holes") this will be the last index. If the
> array has holes, this index is not well specified. We thought that
> this is as useful (or as useless) as the current smallest index.
> The motivation is that the previous algorithm was O(n),
> while this one is O(log n).
> -- Roberto