[glib: 2/8] Add some notes on complexity in glib/ghash.c
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 2/8] Add some notes on complexity in glib/ghash.c
- Date: Wed, 2 Sep 2020 13:09:54 +0000 (UTC)
commit cbae555a98b07ca7f8455856376f41c75f1677e2
Author: Emmanuel Fleury <emmanuel fleury gmail com>
Date: Tue Aug 6 18:48:12 2019 +0200
Add some notes on complexity in glib/ghash.c
Related to issue #3
glib/ghash.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/glib/ghash.c b/glib/ghash.c
index 4fe2912fb..40a0fb2ca 100644
--- a/glib/ghash.c
+++ b/glib/ghash.c
@@ -68,13 +68,14 @@
* given a key the value can be found quickly
*
* A #GHashTable provides associations between keys and values which is
- * optimized so that given a key, the associated value can be found
- * very quickly.
+ * optimized so that given a key, the associated value can be found,
+ * inserted or removed in amortized O(1). All operations going through
+ * each element take O(n) time (list all keys/values, table resize, etc.).
*
* Note that neither keys nor values are copied when inserted into the
* #GHashTable, so they must exist for the lifetime of the #GHashTable.
* This means that the use of static strings is OK, but temporary
- * strings (i.e. those created in buffers and those returned by GTK+
+ * strings (i.e. those created in buffers and those returned by GTK
* widgets) should be copied with g_strdup() before being inserted.
*
* If keys or values are dynamically allocated, you must be careful to
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]