Of course your problem can be fixed with code. It's not that
you are asking for something that's not solvable on a Turing
machine. As for wether you need to implement a different
algorithm, that's up to you. I described an efficient algorithm.
If you find an implementation of a naive algorithm (matching
everything from one file with every thing from the other)
fast enough, then stick with it. But I got the impression
you had some very large datasets. And very large times very
large is big.
As for the algorithm being sophisticated, that depends on what
you find sophisticated. I don't find the algorithms itself
sophisticated, but then, I did research in this field for a
few years. And I wouldn't do the implementation in an evening
either. But I'm a slow coder.
Abigail | [reply] |
It looks like
Set::Infinite
and
Array::IntSpan
could be helpful starting points.
If all the companies had mutually-exclusive ranges, then you could simply place them in an Array::IntSpan and look them up. But since your ranges intersect, you will need to intersect them with each other (using the operations of Set::Infinite like intersects and contains). That's basically what a tree algorithm would do.
| [reply] |