help retrieving / storing info in dictionary or gadfly
Andreas Jung
andreas at andreas-jung.com
Mon Jan 15 05:57:46 EST 2001
On Mon, Jan 15, 2001 at 06:10:31AM +0000, Bryan Webb wrote:
> Hello,
> I have a dictionary that has records with keys from 1 to 2^128
> I can build a list and sort the keys in order, then search thru the list of
> sorted keys.
> If the list has 1,2,3,4,5,7,8,9 and I need to search for 6. 6 is not in
> the list , so I need the record that is closest to 6 but not greater than 6.
> Is there a way to further index the list of keys to do this ?
The trivial approach is to implement some kind of binary search. Please
refer to secondary literature how to implement binary search.
>
> Could I use GADFLY to do this.
This depends on the number of your datasets. When your data does not fit
into your main memory I would use a database (e.g. Gadfly). Maybe
you can tell us about your environment...
Andreas
More information about the Python-list
mailing list