summaryrefslogtreecommitdiff
path: root/src/basic/prioq.c
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2015-09-29 12:48:14 +0200
committerDavid Herrmann <dh.herrmann@gmail.com>2015-09-29 12:49:25 +0200
commitf36f8f78917679f04d6735a79c317b2d4bfeec18 (patch)
treeba99c4d162e2c066b6c2f84b40781e785af6f006 /src/basic/prioq.c
parent9dc5db34adbd6fa3d2ac08d9610d401ba69cde93 (diff)
downloadsystemd-f36f8f78917679f04d6735a79c317b2d4bfeec18.tar.gz
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'.
Diffstat (limited to 'src/basic/prioq.c')
-rw-r--r--src/basic/prioq.c10
1 files changed, 10 insertions, 0 deletions
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 <http://www.gnu.org/licenses/>.
***/
+/*
+ * 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"