On 14 Jan 2017, at 01:57, David Adams <[email protected]> wrote:

> 4D introduced binary searches on arrays back in V14 R4…..What I can't find is 
> a companion function for calculating the insert
> position of a new element


Interesting point.

Maybe the thinking was that the ratio of lookup actions to populating actions 
is normally so huge that there’s no advantage in optimising the former ?

It seems unlikely that one would want to alternately add an element - do a look 
up - add an element - do a lookup etc..in iterations running into the 10’s of 
thousands which is what it takes for “Find in Array” to start becoming 
noticeably sub-optimal compared to binary searches. (Although, once it does, 
the binary search makes a massive difference, especially in recursive logic 
where the number of array lookups increases exponentially with the size of the 
array).

Peter
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[email protected]
**********************************************************************

Reply via email to