sorting values in dict

Courageous jkraska1 at san.rr.com
Fri Jun 15 03:11:00 CEST 2001


On Thu, 14 Jun 2001 23:24:11 +0200, Jeroen Wolff <jwolff at knoware.nl> wrote:

>I want to display a dict sorted by value.
>But i would like to have is sorted (on screen) by value....

I don't know what you really want here. Since others have already
posted some suggestions, I'll simply observe that when a programmer
wants "fast look up, ordered entries," a tree structure of some time is
generally used. The use of the appropriate tree eliminates the need
to sort the container at any given time, as the tree is kept in order; you'll
find an entry in O(log N) time. Look in the Vaults for an implementation.

C//




More information about the Python-list mailing list