Hi, Can someone tell me if there is a bulit in Binary search function for
python lists ?
I am currently building lists and sorting them with a comparison function.
The only list search function I know is List.Index(X), which is pretty
inefficient I reckon, especially hen the lists are likely t
> Hi, Can someone tell me if there is a bulit in Binary search function
> for python lists ?
>
> I am currently building lists and sorting them with a comparison
> function. The only list search function I know is List.Index(X), which
> is pretty inefficient I reckon, especially hen the lists are
[EMAIL PROTECTED] wrote:
>
> Hi, Can someone tell me if there is a bulit in Binary search function for
> python lists ?
The bisect module implements a binary search though it doesn't support custom
comparison functions. You could make your list elements be instances of a class
with a __cmp__()
> The only list search function I know is List.Index(X), which is
> pretty
> inefficient I reckon, especially hen the lists are likely to contain
> 100's
> or 100's of members.
Have you tried it? How long is it taking?
I'd be very surprised if it there was a serious problem indexing
a list of ev
[EMAIL PROTECTED] wrote:
> Hi, Can someone tell me if there is a bulit in Binary search function for
> python lists ?
>
> I am currently building lists and sorting them with a comparison function.
> The only list search function I know is List.Index(X), which is pretty
> inefficient I reckon, espe
> [EMAIL PROTECTED] wrote:
>> Hi, Can someone tell me if there is a bulit in Binary search function for
>> python lists ?
>>
>> I am currently building lists and sorting them with a comparison function.
>> The only list search function I know is List.Index(X), which is pretty
>> inefficient I reck