Check this function

Here i have implemeted to convert a vector into heap…
But it is showing some different output than video…
Please check this… if i implemented in correct way or not…


Thanks

hello @ashishnnnnn
pls mention for what input u r testing and what is the expected output

Hii…
Inupt is–
8
10 20 5 6 1 8 9 4
Output is–
20 10 8 9 1 5 6 4

Video output–
20 10 9 6 1 5 8 4

see order of data of heap may very from implementation to implementation , so its totally fine if ur output didnt match with video ouput.

to check whether u r getting correct output or not ,try to implement heap sort and pop element one by one ,if u get data in sorted form that means ur code is correct