-
Notifications
You must be signed in to change notification settings - Fork 665
feat(collections/unstable): add non-exact binary search function #6628
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
Conversation
f54614b to
4275ba5
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6628 +/- ##
=======================================
Coverage 94.80% 94.80%
=======================================
Files 574 575 +1
Lines 46511 46530 +19
Branches 6549 6553 +4
=======================================
+ Hits 44093 44112 +19
Misses 2375 2375
Partials 43 43 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
4275ba5 to
386e808
Compare
| * Binary searching may be preferable to `Array#findIndex` if the array is | ||
| * large and performance is at a premium, or if information about the insertion | ||
| * index is needed upon non-exact matches (`Array#findIndex` simply returns | ||
| * `-1` in such cases). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
kt3k
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Towards #3069.
Note that this adds a new
binarySearchfunction undercollections, which operates on array-likes of sorted numbers/bigints/strings and implements the same semantics as C#'sArray.BinarySearchand Java'sArrays.binarySearch. It doesn't patch the existingBinarySearchTreeunderdata-structures(@WWRS has a separate open PR for that: #6544).