fbpx
Wikipedia

2–3 heap

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.

heap, computer, science, data, structure, variation, heap, designed, tadao, takaoka, 1999, structure, similar, fibonacci, heap, borrows, from, tree, time, costs, some, common, heap, operations, delete, takes, displaystyle, amortized, time, decrease, takes, con. 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 O log n displaystyle O log n amortized time Decrease key takes constant amortized time Insertion takes constant amortized time Contents 1 Polynomial of trees 1 1 Operations on r nomial queues 2 2 3 heap 2 1 Operations on 2 3 heap 3 ReferencesPolynomial of trees editSource 1 A linear tree of size r displaystyle r nbsp is a sequential path of r displaystyle r nbsp nodes with the first node as a root of the tree and it is represented by a bold r displaystyle mathbf r nbsp e g 1 displaystyle mathbf 1 nbsp is a linear tree of a single node Product P ST displaystyle P ST nbsp of two trees S displaystyle S nbsp and T displaystyle T nbsp is a new tree with every node of S displaystyle S nbsp is replaced by a copy of T displaystyle T nbsp and for each edge of S displaystyle S nbsp 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 S T displaystyle S T nbsp of two trees S displaystyle S nbsp and T displaystyle T nbsp is the collection of two trees S displaystyle S nbsp and T displaystyle T nbsp An r ary polynomial of trees is defined as P ak 1rk 1 a1r a0 displaystyle P mathbf a k 1 mathbf r k 1 dots mathbf a 1 mathbf r mathbf a 0 nbsp where 0 ai r 1 displaystyle 0 leq a i leq r 1 nbsp This polynomial notation for trees of n displaystyle n nbsp nodes is unique The tree airi displaystyle mathbf a i mathbf r i nbsp is actually ai displaystyle a i nbsp copy of ri displaystyle mathbf r i nbsp that their roots are connected with ai 1 displaystyle a i 1 nbsp edges sequentially and the path of these ai 1 displaystyle a i 1 nbsp edge is called the main trunk of the tree airi displaystyle mathbf a i mathbf r i nbsp 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 airi displaystyle mathbf a i mathbf r i nbsp and ai ri displaystyle mathbf a i mathbf r i nbsp we just reorder the trees in the main trunk based on the keys in the root of trees If ai ai r displaystyle a i a i geq r nbsp we will have a term of form ai ai r ri displaystyle mathbf a i mathbf a i mathbf r mathbf r i nbsp and a carry tree ri 1 displaystyle mathbf r i 1 nbsp Otherwise we would have only a tree ai ai ri displaystyle mathbf a i mathbf a i mathbf r i nbsp So the sum of two r nomial queues are actually similar to the addition of two number in base r displaystyle r nbsp 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 O rlogr n displaystyle O r log r n nbsp time To delete the minimum first we need to find the minimum in the root of a tree say T displaystyle T nbsp then we delete the minimum from T displaystyle T nbsp and we add the resulting polynomial queue Q displaystyle Q nbsp to P T displaystyle P T nbsp in total time O rlogr n displaystyle O r log r n nbsp 2 3 heap editSource 1 An l r displaystyle l r nbsp tree T i displaystyle T i nbsp is defined recursively by T i T1 i 1 Ts i 1 displaystyle T i T 1 i 1 triangleleft dots triangleleft T s i 1 nbsp for i 1 displaystyle i geq 1 nbsp s displaystyle s nbsp is between l displaystyle l nbsp and r displaystyle r nbsp and s 1 displaystyle s 1 nbsp displaystyle triangleleft nbsp operations are evaluated from right to left where for two trees A displaystyle A nbsp and B displaystyle B nbsp the result of the operationA B displaystyle A triangleleft B nbsp is connecting the root of B displaystyle B nbsp as a rightmost child to the root of A displaystyle A nbsp and T 0 displaystyle T 0 nbsp is a single node tree Note that the root of the tree T i displaystyle T i nbsp has degree i displaystyle i nbsp An extended polynomial of trees P displaystyle P nbsp is defined by P ak 1T k 1 a1T 1 a0 displaystyle P a k 1 T k 1 dots a 1 T 1 a 0 nbsp If we assign keys into the nodes of an extended polynomial of trees in heap order it is called l r heap displaystyle l r heap nbsp and the special case of l 2 displaystyle l 2 nbsp and r 3 displaystyle r 3 nbsp is called 2 3 heap displaystyle 2 3 heap nbsp Operations on 2 3 heap edit Delete min First find the minimum by scanning the root of the trees Let T i displaystyle T i nbsp be the tree containing minimum element and let Q displaystyle Q nbsp be the result of removing root from T i displaystyle T i nbsp Then merge P T i displaystyle P T i nbsp and Q displaystyle Q nbsp 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 T 0 displaystyle T 0 nbsp labeled with this key Decrease Key To be done References edit 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 Retrieved from https en wikipedia org w index php title 2 3 heap amp oldid 1179525485, wikipedia, wiki, book, books, library,

article

, read, download, free, free download, mp3, video, mp4, 3gp, jpg, jpeg, gif, png, picture, music, song, movie, book, game, games.