predictivesearch 1.0.2
A searching algorithm which may be faster than binary search
To use this package, run the following command in your project's root directory:
Manual usage
Put the following dependency into your project's dependences section:
PredictiveSearch
A searching algorithm which may be faster than binary search
(this depends on your architecture, as it reduces array accesses in exchange for extra branches)
If you've ever been told that binary search is theoretically optimal: this would be the counterproof.
Both algorithms work on average in O(log(n)) time, but this one is more likely to get the value on the first (or rather third) try.
It works on the requirement that the data is sorted and on the assumption that it is uniformally distributed. This should still be comparable to or better than binary search for most arrays, as even if it isn't uniformally distributed, if it is random, then subarrays will increasingly be closer to a uniform distribution as their size decreases.
Of course, it is possible to generate an array where this devolves into linear search but in general, it shouldn't happen.
 1.0.2 released 3 months ago
 phebert5009/PredictiveSearch
 MIT
 Copyright © 2024, phebert5009
 Authors:
 Dependencies:
 none
 Versions:

1.0.2 2024Feb12 1.0.1 2024Feb12 1.0.0 2024Feb12 ~stable 2024Feb12  Download Stats:


0 downloads today

0 downloads this week

0 downloads this month

1 downloads total

 Score:
 0.3
 Short URL:
 predictivesearch.dub.pm