I have a midterm exam next week and am having difficulty drawing out a binary heap. The invariant for a minimum binary heap is: the value of the item stored at a parent node is always less than (greater than) the values of the items stored at its child nodes. The part that I don't understand is when I am inserting values into the heap, how do I know whether to go left or right? I'd really like to see step by step solutions, because I just don't understand how I would know whether to go left or right.
Say I have the values: 5, 8, 13, 15, 1, 2, 12, 4 it would start like
5 then I insert 8
/ \
8? 13? is this going in the right direction?
I know for binary search trees the invariant is left< parent < right, but I am just really confused on how to determine whether to go left or right.