Let's suppose that we have geoip database:
This database have a lot of strings, but all this data can perfectly fit memory (about 200-500Mb). Now we need to find country by ip. What data structure fits best for doing it (we'll transfer all IP to int, of course)?
Best How To :
An array that's sorted by the range start value will let you find the proper range with a simple binary search. I don't know how many address ranges you're working with, but even if you had a million ranges the binary search will take at most 20 probes. You could easily do tens of thousands of lookups per second with that.
Another option is a segment tree, although I don't see it being particularly helpful in this situation since you don't have overlapping intervals.