data structures using the algorithm destroys the original representations of heaps and apart step set create_binomial-heap(from link_binomial-tree()it uses another step set head[hmerge_binomial-heap( procedure merge_binomial-heap(which step free the memory occupied by and is used to merge the root lists of and step if head[hnullthen return into single linked list that is sorted by step set prev nullptr head[hand next sibling[ptrdegree into monotonically increasing step repeat step while next null order step if degree[ptrp degree[nextor in the algorithmsteps to merge (sibling[nextp null and the root lists of binomial heaps and degree[sibling[next]degree[ptr])then into single root list in such way that set prev ptrptr next else if val[ptrps val[next]then and are sorted strictly by increasing set sibling[ptrsibling[nextdegree merge_binomial-heap(returns link_binomial-tree(nextptrroot list that is sorted by monotonically else increasing degree if there are roots if prev nullthen head[hnext in the root lists of and then merge_ else binomial-heap(runs in (mtime this sibling[prevnext procedure repeatedly examines the roots link_binomial-tree(ptrnextset ptr next at the heads of the two root lists and set next sibling[ptrappends the root with the lower degree step return to the output root listwhile removing it from its input root list step of the algorithm checks if there figure algorithm to unite two binomial heaps is at least one root in the heap the algorithm proceeds only if has at least one root in step we initialize three pointersptr which points to the root that is currently being examinedprev which points to the root preceding ptr on the root listand next which points to the root following ptr on the root list in step we have while loop in which at each iterationwe decide whether to link ptr to next or next to ptr depending on their degrees and possibly the degree of sibling[nextin step we check for two conditions firstif degree[ptrp degree[next]that iswhen ptr is the root of bi tree and next is the root of bj tree for some ithen ptr and next are not linked to each otherbut we move the pointers one position further down the list secondwe check if ptr is the first of three roots of equal degreethat isunion_binomial-heap( degree[ptrdegree[nextdegree[sibling[next]in this case alsowe just move the pointers one position further down the list by writing prev ptrptr next howeverif the above if conditions do not satisfythen the case that pops up is that ptr is the first of two roots of equal degreethat isdegree[ptrdegree[nextp degree[sibling[next]in this casewe link either ptr with next or next with ptr depending on whichever has the smaller key of coursethe node with the smaller key will be the root after the two nodes are linked the running time of union_binomial-heap(can be given as ( og )where is the total number of nodes in binomial heaps and if contains nodes and contains nodesthen contains at most og( roots and contains at most og( rootsso contains at most ( og og ps ( og ( og nroots when we call merge_binomial-heap(sincen the merge_binomial-heap(takes (log nto execute each iteration of the while loop takes ( timeand because there are at most ( og og iterationsthe total time is thus (log