Heapifying up and down with min and max heaps

I AM SO CONFUSED. I’ve read the conceptual part of heaps in python several times now and I for the life of me can never figure out the correct answers to the heapifying up or down process on the quiz. Every time I think I understand it I select and answer and I’m wrong.

It even seems that there are two answers that are saying the same thing like “If the parent is greater than the child, swap them” and the other one saying “If the child is less than the parent, swap the two” and I always choose the wrong one.

and then the whole time I’m trying to figure out the process for min-heaps and then it throws the completely opposite question at me asking about heapifying up with a max-heap. Does this confuse anyone else or am I going insane???

Here is the link to the test:


I remember also having a bit of a gap between the concept and the code.

To get a better feel: I personally just wrote the code by hand and ran through the instructions, summarizing the effect of each one. Sure… it’s a bit slow, but it stuck a lot better :slight_smile: … very subjective method though.

1 Like

Thank you I’ll try that too. I eventually just went to look stuff up and I think I managed to figure something out. I guess I’ll find out when I get to the code :grimacing: thank you !