Self optimizing iterable
zac256 at gmail.com
Fri Jul 17 20:31:44 EDT 2009
I would like a set like object that when iterated maintains a count of
where iteration stopped and then re-orders itself based on that count
so that the iteration stopped on the most bubble to the top.
An example use case for this would be for something like a large table
of regular expressions that would be iterated over trying to match in
some string. If some regular expressions are more statistically more
successful then the iteration will generally be short.
Does anyone know of a pre-existing recipe for this or feel like taking
on the challenge?
Bonus points for:
Best possible BigO notation on switching order and iteration
Extend to also include a mapping version
Aim - Zac256FL
Production Engineer (Digital Overlord)
More information about the Python-list