jeff at ccvcorp.com
Tue Feb 5 19:50:27 CET 2002
Colin Brown wrote:
> I am trying to implement a simple scheduler in Python where the deadline
> times of (non-prioritised) entries as entered are not necessarily in
> chronological order. From what I see on the Web this is best described as an
> "Earliest Deadline First" scheduler.
Go to the Python Cookbook (http://aspn.activestate.com/ASPN/Cookbook/Python) and
search for "Priority Queue" -- there's a couple of different implementations
there, one of which should suit your needs (or be close enough to show you how
to write your own).
The basic idea is that the queue itself will sort its entries, so that you can
place things in the queue in any order but they will be popped from it
highest-priority-first (however "highest priority" is defined).
More information about the Python-list