Ruby latest stable (v2_5_5) - 0 notes - Class: Array
bsearch_index() public

By using binary search, finds an index of a value from this array which meets the given condition in O(log n) where n is the size of the array.

It supports two modes, depending on the nature of the block. They are exactly the same as in the case of the #bsearch method, with the only difference being that this method returns the index of the element instead of the element itself. For more details consult the documentation for #bsearch.

Show source
Register or log in to add new notes.