help retrieving / storing info in dictionary or gadfly

local2me at my-deja.com local2me at my-deja.com
Sat Jan 20 00:12:56 EST 2001


In article <mailman.979556300.9232.python-list at python.org>,
  Andreas Jung <andreas at andreas-jung.com> wrote:
> 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.


Or use bisect.py in standard distribution.


. . . . . . . . . .
www.Local2Me.com - Personalized, Local Internet Communities for SF
Peninsula Cities!  Connect with your neighbors via group email.


Sent via Deja.com
http://www.deja.com/



More information about the Python-list mailing list