]> mj.ucw.cz Git - libucw.git/commitdiff
Heaps: Small fixes in comments.
authorPavel Charvat <pchar@ucw.cz>
Wed, 22 Aug 2018 17:06:15 +0000 (19:06 +0200)
committerPavel Charvat <pchar@ucw.cz>
Wed, 22 Aug 2018 17:06:15 +0000 (19:06 +0200)
ucw/heap-gen.h

index 393c6c9c52b1f63f799b56f047e0545bace3968c..c1a66d06324c2cc278fdfa49c525b263d6fd582a 100644 (file)
@@ -73,7 +73,7 @@
  * We support both "Type 1" (default) and "Type 2" variants from [3],
  * and also both "1-pass" (default) and "m-pass" merging.
  *
- * FIXME: And maybe also try the 1-tree representation.
+ * FIXME: Maybe also try the 1-tree representation.
  */
 
 #  if !defined(HEAP_RANK_PAIRING_TYPE1) && !defined(HEAP_RANK_PAIRING_TYPE2)
@@ -290,7 +290,8 @@ P(cut_root_and_consolidate)(P(heap_p) h, P(node_p) a)
   // @parent pointers in the list are undefined.
 
   // Allocate array of buckets -- per-rank storage for an odd half-tree used during the merge.
-  // To achieve constant time, we track current subset of visited ranks in a bitmask, other indices stay undefined.
+  // To achieve constant time initialization, we track current subset of visited ranks in a bitmask, other indices stay undefined.
+  // Alternatively we could spend O(max current rank) time for initializations, the amortized complexity would be same.
   P(node_p) bucket[HEAP_MAX_RANK + 1];
   byte bucket_ary[HEAP_MAX_RANK + 1];
   byte bucket_count = 0;
@@ -468,7 +469,8 @@ P(cut_root_and_consolidate)(P(heap_p) h, P(node_p) a)
   // @left, @parent and @mark fields in the list are undefined.
 
   // Allocate array of buckets -- per-rank storage for an odd tree used during the merge.
-  // To achieve constant time, we track current subset of visited ranks in a bitmask, other indices stay undefined.
+  // To achieve constant time initialization, we track current subset of visited ranks in a bitmask, other indices stay undefined.
+  // Alternatively we could spend O(max current rank) time for initializations, the amortized complexity would be same.
   P(node_p) bucket[HEAP_MAX_RANK + 1];
   byte bucket_ary[HEAP_MAX_RANK + 1];
   byte bucket_count = 0;