[2.5.1.1/dictionary] Change sorting order?

Neil Cerutti neilc at norwich.edu
Fri Jan 22 11:52:05 EST 2010


On 2010-01-22, Steven D'Aprano <steve at REMOVE-THIS-cybersource.com.au> wrote:
>> O(N*Log N) + O(N) == O(N**2)?
>
> Oops!  :(
>
> Of course, the sort is in fast C, and the linear search is in
> relatively slow Python, so it is quite conceivable that for
> realistic amounts of data, the time could be dominated by the
> searching.
>
> Or the OP might just change his requirements and allow starting
> the display in the middle of the letter.

That's what I would advocate. The scheme of starting at a random
(or cycling through) first letters still grants an arbitrary
advantage to some user names. A random starting position is thus
more fair *and* more efficient. ;)

-- 
Neil Cerutti



More information about the Python-list mailing list