If you use a slightly different data structure, you could even use a modified binary search to find the proper bucket, resulting in log2(N) comparisons instead of N/2 comparisons (on average).
Update: Ignore this - Laurent_R's solution assumes an already sorted data set and just steps through it. $coffee++.
--MidLifeXis
In reply to Re^2: Perl hit counter for multiple ranges, optimization or options in other languages?
by MidLifeXis
in thread Perl hit counter for multiple ranges, optimization or options in other languages?
by SaktiMonk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |