[DGD] finding an index by a value

Par Winzell zell at skotos.net
Sat Jan 10 17:46:40 CET 2004


> I remember there was an efun in other drivers for finding an index 
> number of an array by the value it contains. Is there any similar kfun 
> to do this, or do I have to write my own in lpc (which will be very slow 
> on large arrays) ?

Write your own. And I'll say the obvious: If you find yourself doing 
this fairly often, you need an index in the other direction as well. If 
there were implemented in the driver, it would be a constant factor 
faster (although not as big a constant as you probably think), but you 
would still be in the domain of O(N).

Zell

_________________________________________________________________
List config page:  http://list.imaginary.com/mailman/listinfo/dgd



More information about the DGD mailing list