in reply to Re: Code efficiency / algorithm
in thread Code efficiency / algorithm

:( Does this mean my problem cannot be fixed with code? I need to actually implement a different algorithm? I will go check up on that error and see what I can do to mitigate it. If I can't can you offer any tips on how to convert to the tree algorithm? Is it an easy conversion/coding or am I looking at something pretty sophisticated here? Thanks for the help!!! David =8-)

Replies are listed 'Best First'.
Re: Code efficiency / algorithm
by Abigail-II (Bishop) on Jan 14, 2003 at 16:38 UTC
    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

Re: Re: Re: Code efficiency / algorithm
by tall_man (Parson) on Jan 14, 2003 at 16:51 UTC
    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.