Opportunistic worst-case complexity upgrade? aka binary search with `find`
Xinok via Digitalmars-d
digitalmars-d at puremagic.com
Sun Jul 27 12:36:04 PDT 2014
On Thursday, 24 July 2014 at 01:26:48 UTC, Jakob Ovrum wrote:
> On Thursday, 24 July 2014 at 01:21:44 UTC, Jakob Ovrum wrote:
>> -snip-
>
> Another point is that the range types of the two currently
> available sorted containers - RedBlackTree and BinaryHeap - are
> *not* instances of SortedRange. If algorithms working on sorted
> ranges become a thing, it seems like they should be.
Just to clarify, BinaryHeap is heapified but not sorted, so it
would be impossible to do a binary search on it. It's only an
InputRange so, at best, you could do a linear search on it.
More information about the Digitalmars-d
mailing list