which datastructure for fast sorted insert?

I V ivlenin at gmail.com
Sun May 25 16:07:15 EDT 2008


On Sun, 25 May 2008 13:05:31 -0300, Gabriel Genellina wrote:
> Use a list, and the bisect module to keep it sorted:

That's worth doing if you need the data to be sorted after each insert. 
If the OP just needs the data to be sorted at the end, using a data 
structure with fast inserts (like a set) and then sorting at the end will 
likely be faster.



More information about the Python-list mailing list