Should not binary search algorithm return the position in the array?
Closed this issue · 0 comments
eush77 commented
In its current form the binary search algorithm is not really useful, because in most cases it is not only the presence of a value that matters but also the position in the array.
I suggest that the binary search interface should mimic the standard Array#indexOf
, in which case the algorithm could be considered as a more efficient alternative to indexOf
for sorted arrays.