in reply to brainteaser: splitting up a namespace evenly

If you really need them spread out evenly, you could take an MD5 hash of the filename and use it as a base for you directory structure... i.e.:
md/5_hash_value_of_123/123.gif an/other_md5_have_value/456.gif ye/t_another_hash_value/789.gif
Or, You might want to see if the last two digits are "spread out enough" and build a directory structure based on that.... i.e.:
98/123456789.gif 09/123456790.gif 19/123456791.gif

-Blake

Replies are listed 'Best First'.
Re: Re: brainteaser: splitting up a namespace evenly
by perrin (Chancellor) on Oct 24, 2001 at 03:54 UTC
    Sorry, I should have said this in my question:

    I'd prefer to have directory paths that a human can generate easily by looking at the ISBN. That means MD5 is out.

    UPDATE: The idea about whether or not the last two digits are "spread out enough" is the gist of what I'm looking for, only I don't want to have to manually try the last two digits, and then the next to last, etc. until I find the solution that spreads them out enough while having the fewest number of directories.

      OK, you'll have to give us a bit more information about the set of numbers you're trying to hash...... Tough to come up with a clever way to spread them out when we don't know much about the set. ;-)

      -Blake

        To solve the brainteaser, the solution should be able to work on any set of 10000 randomly generated nine digit numbers. Anything short of that is just practical, and I'm in this for the fun of it at this point. :)