Try adding an element, then right afterwards. This will maintain the heap property. (It will not work if you add multiple then heapify up - you will have to for that.)
Try popping the root. This will automatically replace the root with the most recently added element. To restore the heap property after doing this, try running .
Try adding an element, then right afterwards. This will maintain the heap property. (It will not work if you add multiple then heapify up - you will have to for that.)
Try popping the root. This will automatically replace the root with the most recently added element. To restore the heap property after doing this, try running .