Binary search

Jakob Ovrum via Digitalmars-d-learn digitalmars-d-learn at
Mon Dec 14 16:36:07 PST 2015

On Tuesday, 15 December 2015 at 00:31:45 UTC, Jakob Ovrum wrote:
> For sorted arrays you won't find any other standard facility 
> for doing binary search, but the containers RedBlackTree and 
> BinaryHeap provide something related.

You could also get the upper bound (SortedRange.upperBound) and 
calculate the index from its length. If I'm thinking straight, 
this might result in fewer comparisons for some patterns.

More information about the Digitalmars-d-learn mailing list