# Intrare binomială a opțiunilor binare

Because the number of children for each node is variable, it does not work well for each node to have separate links to each of its children, as would be common in a binary tree ; instead, it is possible to implement this tree intrare binomială a opțiunilor binare links from each node to its highest-order child in the tree, and to its sibling of the next smaller order than it.

These sibling pointers can be interpreted as the next pointers in a linked list of the children of each node, but with the opposite order from the linked list of roots: from largest to smallest order, rather than vice versa. This representation allows two trees of the same order to be linked intrare binomială a opțiunilor binare, making a tree of the next larger order, in constant time.

The result is a tree of order 3. The operation of merging two heaps is used as a subroutine in most other operations.

A basic subroutine within this procedure merges pairs of binomial trees of the same order. This may be done by comparing the keys at the roots of the two trees the smallest keys in both trees.

The root node with the larger key is made into a child of the root node with the smaller key, increasing its order by intrare binomială a opțiunilor binare   function mergeTree p, q if p.

This is accomplished by merging two binomial trees of the same order one by one.

If the resulting merged tree has the same order as one binomial tree in one of the two heaps, then those two are merged again.

To merge two heaps more generally, the lists of roots of both heaps are traversed simultaneously in a manner similar to that of the merge algorithmin a sequence from smaller orders of trees to larger orders.

In the course of the algorithm, it will examine at most three trees of any order, two from the two heaps we merge and one composed of two smaller trees. Whenever a carry occurs during addition, this corresponds to a merging of two binomial trees during the merge.