2–3 heap

From Wikipedia, the free encyclopedia

In computer science, a 2–3 heap is a data structure, a variation on the heap, designed by Tadao Takaoka in 1999. The structure is similar to the Fibonacci heap, and borrows from the 2–3 tree.

Time costs for some common heap operations are:

  • Delete-min takes amortized time.
  • Decrease-key takes constant amortized time.
  • Insertion takes constant amortized time.

Polynomial of trees[edit]

Source:[1]

A linear tree of size is a sequential path of nodes with the first node as a root of the tree and it is represented by a bold (e.g. is a linear tree of a single node). Product of two trees and , is a new tree with every node of is replaced by a copy of and for each edge of we connect the roots of the trees corresponding to the endpoints of the edge. Note that this definition of product is associative but not commutative. Sum of two trees and is the collection of two trees and .

An r-ary polynomial of trees is defined as where . This polynomial notation for trees of nodes is unique. The tree is actually copy of that their roots are connected with edges sequentially and the path of these edge is called the main trunk of the tree . Furthermore, an r-ary polynomial of trees is called an r-nomial queue if nodes of the polynomial of trees are associated with keys in heap property.

Operations on r-nomial queues[edit]

To merge two terms of form and , we just reorder the trees in the main trunk based on the keys in the root of trees. If we will have a term of form and a carry tree . Otherwise, we would have only a tree . So the sum of two r-nomial queues are actually similar to the addition of two number in base .

An insertion of a key into a polynomial queue is like merging a single node with the label of the key into the existing r-nomial queue, taking time.

To delete the minimum, first, we need to find the minimum in the root of a tree, say , then we delete the minimum from and we add the resulting polynomial queue to in total time .

(2,3)-heap[edit]

Source:[1]

An tree is defined recursively by for ( is between and and operations are evaluated from right to left) where for two trees, and , the result of the operation is connecting the root of as a rightmost child to the root of and is a single node tree. Note that the root of the tree has degree .

An extended polynomial of trees, , is defined by . If we assign keys into the nodes of an extended polynomial of trees in heap order it is called , and the special case of and is called .

Operations on (2,3)-heap[edit]

Delete-min: First find the minimum by scanning the root of the trees. Let be the tree containing minimum element and let be the result of removing root from . Then merge and (The merge operation is similar to merge of two r-nomial queues).

Insertion: In order to insert a new key, merge the currently existing (2,3)-heap with a single node tree, labeled with this key.

Decrease Key: To be done!

References[edit]

  1. ^ a b Takaoka, Tadao (March 2003). "Theory of 2–3 Heaps". Discrete Applied Mathematics. 126 (1): 115–128. doi:10.1016/S0166-218X(02)00219-6.