If you have *lots* of numbers or if you did often, it would be better to use a binary search on a sorted array rather than using a hash.
| dreadpiratepeter's | O(N log N) |
| Best hash | O(N) |
| Best unsorted array | O(N) |
| Binary search (must be sorted) | O(log N) |
Update: Added links.
In reply to Re: Setting In-between values in a hash (interpolating)
by ikegami
in thread Setting In-between values in a hash (interpolating)
by ravishi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |