Normal deletion is possible, as is DeleteMin / Max. The βproblemβ is that you need to check both the upper and the lower gears (that is, when the βlastβ node takes a vacant position, it may be overfulfilled or underestimated. Since it still cannot be both, the obvious reasons, it is easy to verify the correctness.
The only problem that remains is Find. The answer above says that you can find the element in O (log n), but I don't know how to do this. In my implementations, I usually create a bunch of pointers to elements, not elements (cheaper copying during up / down). I add the variable "position" to the Element type, which tracks the index of the Element pointer on the heap. Thus, given element E, I can find its position on the heap in constant time.
Obviously, this is not cut out for every implementation.
source share