2) Parent key value are smaller than child key value.

Example OF Min Heap

Check this given tree are min heap or not?

This Given tree are 11 nodes and there are complete fill then this are satisfied 1 propeties. Know check second properties. Parent node are smaller to child node.

Start with root node [49].

Parent node [49] value is smaller in left and right child [98,194]. that means this node are satisfied second condition. check other node.

Check node [98]

Parent node [89] value is smaller in left and right child [128,452]. that means this node are satisfied second condition. check other node.

Check another node [128]

Parent node [128] value is greater in left child [2]. that means this is not min heap.

Min heap conversion

Convert This Tree to Min heap step by step

Node [128] is not satisfied min heap. then swapping the node values 128 to 2.

Note that after swapping this two node value again check previous node. In this time checking the node [98].

Node [98 value] are bigger to left child then swap those value [98<=>2].

In this time swapping the values of [98<=>20].

Check node [452].

Swap node data [452<=>35]

Check Node [2].

Check node [49].

Swap node data [42<=>2].

Check node [49].

Swap node Data [20<=>49].

Check node [194].

Swap node data [85<=>194].

Finally Tree is convert to min heap

How To Insert Min heap node

Insert node [1]. In given Tree.

After insert

After insert node [1]. tree are not min heap then convert.

Swap node data [1<=>198].

Check Node [85].

Swap node value [1<=>85].

Check Node [2].

Swap node value [1<=>2].

Convert Min Heap.

How to use

Suppose following [10, 9, 8, 7, 6, 5, 4, 3, 2, 1] data are inserted on min heap. Put your data separated by hyphen-minus sign (-) and putting on input field.

Like This 10-9-8-7-6-5-4-3-2-1.

showing on input field and click to submit button . And view min heap operation like insertion and deletion.

Possible to submit any number of positive numeric value but separate by (-) minus symbol. Note that if you have not given any data. So this editor will put default 10 numeric value.

Learn basic concept of c , c++ and python programming in regularcodes.com