Skew Heap in Data Structures

A heap data structure that is implemented in the form of a binary tree is known as a skew heap. These are very beneficial especially because of the merging capability which is quite more than the binary heaps. In comparison to the binary heaps there are no constraint structures which mean there is no guarantee that the tree height will be logarithmic. For this only two conditions are must firstly the general heap used should be enforced and secondly, the use of special heap merge is necessary for the merging of every two skew heaps.

A skew heap is nothing but only advanced and self-adjusting version of the leftist heap that can balance by thaw swapping of nodes unconditionally during the merging of two heaps in the merge path. In case of removing and adding values these merge paths are used. A skew heap will be of no use without the structural constraints. According to the complexity analysis it can be used for the demonstration of all operations of a skew heap in O (log n).

We can use the leftist heap in case of merging two skew heaps. This is the same process that is stated above. It helps in

Comparing of two heap roots

It also swaps the new heap

It merges the heap having the long root with the correct sub tree of the other heap.

It merges the result of the correct sub tree with a small root heap.

This is a non recursive process which does not give ant perfect sorting but tends to clear the things a little bit.

Merging a new tree to the node of another heap or original tree is like adding value to a skew heap. The main mode is further linked that becomes the new root itself. 

Download Skew Heap in Data Structures Reference Material.

Leave a Reply

Your email address will not be published. Required fields are marked *