Hello! I am in the Coding Interview Prep section. I passed the challenge Insert an Element into a Max Heap. However, when I test it myself, I don’t think it’s working properly. I will provide my code later if needed, but I just want to make sure I understand max heaps.
The following doesn’t satisfy the heap property, correct?
[ null, 45, 50, 35, 30, 20, 15 ]
Because 50 > 45 and 45 is its parent. However, this is a result when testing my code. But my code still passes.
Or am I misunderstanding max heaps?