0

Maybe it's your ASCII art, but that doesn't look like a heap from where I'm sitting. 100 can't be both a child of 1 and a parent of 3.

By the heap property, if the node containing the max element of the tree is not the root, then that node must be in the bottom row - depends on how your heap's structured, but it's one or the other. So as stated, the node to be removed is in the bottom row, and it's a one-step operation to remove it.

You

This article has been dead for over six months: Start a new discussion instead