Radix Heap
   HOME

TheInfoList



OR:

A radix heap is a
data structure In computer science, a data structure is a data organization, management, and storage format that is usually chosen for efficient access to data. More precisely, a data structure is a collection of data values, the relationships among them, a ...
for realizing the operations of a
monotone priority queue In computer science, a monotone priority queue is a variant of the priority queue abstract data type in which the priorities of extracted items are required to form a monotonic sequence. That is, for a priority queue in which each successively extr ...
. A set of elements to which a key is assigned can then be managed. The run time of the operations depends on the difference between the largest and smallest key or constant. The data structure consists mainly of a series of buckets, the size of which increases
exponentially Exponential may refer to any of several mathematical topics related to exponentiation, including: *Exponential function, also: **Matrix exponential, the matrix analogue to the above * Exponential decay, decrease at a rate proportional to value *Exp ...
.


Prerequisites

# all keys are
natural numbers In mathematics, the natural numbers are those numbers used for counting (as in "there are ''six'' coins on the table") and ordering (as in "this is the ''third'' largest city in the country"). Numbers used for counting are called ''cardinal n ...
; # max. key - min. key \le C for constant C; # the ''extract-min'' operation is monotonic; that is, the values returned by successive ''extract-min'' calls are
monotonically increasing In mathematics, a monotonic function (or monotone function) is a function between ordered sets that preserves or reverses the given order. This concept first arose in calculus, and was later generalized to the more abstract setting of order ...
.


Description of data structure

The three most important
fields Fields may refer to: Music *Fields (band), an indie rock band formed in 2006 *Fields (progressive rock band), a progressive rock band formed in 1971 * ''Fields'' (album), an LP by Swedish-based indie rock band Junip (2010) * "Fields", a song by ...
are: # b of size B := \lfloor log(C+1)\rfloor + 1, with 0 as the lowest index, stores the buckets; # u of size B+1, with 0 as the lowest index, store the (lower) bounds of the buckets; # bNum, holds for each element x in the heap the bucket in which it is stored. The above diagram shows the data structure. The following invariants apply: # u \le key in b < u +1/math>: the keys in b /math> are up or down through the value in u +1/math> or u /math> limited. # u = 0, u = u + 1, u = \infty and 0 \le u +1u \le 2^{i-1} for i = 1, \ldots, B-1: the sizes of the buckets increase exponentially. It is important to note the exponential growth of the limits (and thus the range that a bucket holds). In this way the logarithmic dependence of the field quantities is of value C, the maximum difference between two key values.


Operations

During ''initialization'', empty buckets are generated and the lower bounds u are generated (according to invariant 2); running time O(B). During ''insert'', a new element x is linearly moved from right to left through the buckets and the new element with k(x) is stored in the left bucket to that u \ge k(x); running time O(B). For ''decrease-key'', first the key value is decreased (checking for compliance with the invariants). Then, the bNum field is used to locate the element and it is iterated to the left, if necessary, analogously to the ''insert'' operation. The running time is O(1) (amortized). The ''extract-min'' operation removes an element from bucket b /math> and returns it. If the bucket b /math> is not yet empty, the operation is terminated. If, however, it is empty, the next larger non-empty bucket is searched, its smallest element k tracked and u /math> is set to k (monotonicity is required for this). Then, according to the invariants, the bucket boundaries are redefined and the elements removed b /math> to the newly formed buckets; running time O(1) (amortized). If displayed, the field bNum is updated.


References

* B.V. Cherkassky, A.V. Goldberg, C. Silverstein
''Buckets, Heaps, Lists and Monotone Priority Queues''Abstract
, in: Proceedings of the Eight Annual ACM-SIAM Symposium on Discrete Algorithms. January 1997, pp. 83-92. Heaps (data structures)