Sorted Collection Protocol

I implemented both here. As you'd expect the non-recursive version is fastest on the random access collection SortedArray (both axes are logarithmic):
Sorted%20Random%20access%20-%205%20Tasks

When it comes to using binary search on non-random access collections it seems the built-in start-from-the-beginning-and-check-every-element is faster, at least with DefaultIndices<String>:
Sorted%20Non-Random%20Access%20-%205%20Tasks

All the code is available here.

1 Like