Build Heap Optimised

whats going wrong in my code??
Check for buildHeapOpti and downheapify function , thats where the problem rest code should be fine.

@sounakume
Your output seems fine
What do you think is wrong with your code
I couldn’t find any error

shouldn’t my output be

435 45 100 35 40 20 10 2 20 9 38

instead of this
435 45 100 35 40 20 10 20 2 38 9

@sounakume
Both structures are correct
Heap property should be maintained
Order of elements is irrelevant

Ok, got it, thank you

@sounakume
If you haven’t already then please close the doubt