New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
closest
does too many comparisons
#4
Comments
thanks for the find. ill take a look |
if it finds a matching value it should just return even if the array has duplicates |
Well, I can see what it wouldn't -- because in your README you say |
you're right. hopefully I can look tonight its kinda the whole point of
|
I haven't closely examined the reason why, but in some very basic testing, there were more comparisons than there should have been for an efficient binary search of the
closest
value. For example, the search:outputs:
One option that probably should be supported is to tell the search algorithm that there are no duplicated values so there is no extra work to find the first matching value. That would reduce the comparison count to 1 in the above search.
But even accounting for possible duplicates, there is still an extra comparison.
The text was updated successfully, but these errors were encountered: