From f36f8f78917679f04d6735a79c317b2d4bfeec18 Mon Sep 17 00:00:00 2001 From: David Herrmann Date: Tue, 29 Sep 2015 12:48:14 +0200 Subject: prioq: add introduction comment Add comment to prioq.c explaining what it does. And more importantly, mention that we implement a Heap. It's more than annoying having to figure out what the code actually does, without ever mentioning the word 'heap'. --- src/basic/prioq.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') diff --git a/src/basic/prioq.c b/src/basic/prioq.c index b89888be0e..69ec45d97e 100644 --- a/src/basic/prioq.c +++ b/src/basic/prioq.c @@ -19,6 +19,16 @@ along with systemd; If not, see . ***/ +/* + * Priority Queue + * The prioq object implements a priority queue. That is, it orders objects by + * their priority and allows O(1) access to the object with the highest + * priority. Insertion and removal are Θ(log n). Optionally, the caller can + * provide a pointer to an index which will be kept up-to-date by the prioq. + * + * The underlying algorithm used in this implementation is a Heap. + */ + #include "util.h" #include "prioq.h" -- cgit v1.2.3-54-g00ecf