lib/d_heap.rb in d_heap-0.2.1 vs lib/d_heap.rb in d_heap-0.2.2
- old
+ new
@@ -1,7 +1,19 @@
+# frozen_string_literal: true
+
require "d_heap/d_heap"
require "d_heap/version"
+# A fast _d_-ary heap implementation for ruby, useful in priority queues and graph
+# algorithms.
+#
+# The _d_-ary heap data structure is a generalization of the binary heap, in which
+# the nodes have _d_ children instead of 2. This allows for "decrease priority"
+# operations to be performed more quickly with the tradeoff of slower delete
+# minimum. Additionally, _d_-ary heaps can have better memory cache behavior than
+# binary heaps, allowing them to run more quickly in practice despite slower
+# worst-case time complexity.
+#
class DHeap
def initialize_copy(other)
raise NotImplementedError, "initialize_copy should deep copy array"
end