lua-users home
lua-l archive

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


On Wed, 26 Mar 2008, Javier Guerra wrote:
>
> but also noted that your speed test of the sort()ed queue just inserts
> numbers in the queue, while the heap uses a {key,value} table for each
> item... no fair!

You could avoid this by storing all the keys and values in one table and
the ordering in another, i.e.
	pairs[key] = value
	index[n] = key

Tony.
-- 
f.anthony.n.finch  <dot@dotat.at>  http://dotat.at/
CROMARTY FORTH TYNE: CYCLONIC 4 OR 5, BECOMING SOUTHEAST 5 TO 7 LATER.
MODERATE. SHOWERS. MODERATE OR GOOD.