Ruby | Array bsearch() operation
Array#bsearch() : bsearch() is an Array class method which finds a value from the array that meets with the given condition. It’s complexity is O(log n) where n is the array size. This method can work in both the modes – find-minimum and find-any mode.
Syntax: Array.bsearch() Parameter: - Arrays to search elements. - condition block Return: Array element that satisfy the given condition
Code #1 : Example for bsearch() method
search : 4 search : 4.3 search : 2 search : 111.11
Code #2 : Example for bsearch() method
search : 4 search : 111.11
My Personal Notes arrow_drop_up
Please Login to comment...