Given the following list if IP address ranges.
LOW HIGH
192.168.10.34 192.168.11.200
200.50.1.1 200.50.2.2
Assuming that iterating all the addresses within all the ranges and storing them in a HashSet will use too much memory.
So we need to maintain the ranges, which are actually just shifted numbers anyway (low and high). How would one store the ranges in a tree and then use an efficient search to find whether or not a particular address is within the range(s).
I have looked at RangeTree, but it seems to search for points on a cartesian plane, and doesn't seem suited to my use case. KDTree allows one to search nearest neighbour, and when k==2 it's basically the same as the range tree.
I would want all the matches, as there might be multiple hits.
What would work here? I am very sure this is a solved problem.
