change value of item in BinaryHeap
"Øivind" via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Apr 27 18:49:49 PDT 2014
I am trying to figure out how to change the value of an element
in a BinaryHeap (from std.container) and have it repositioned
such that the heap is still valid.
Can anyone help me with this? The approach I would have taken (I
think) is to remove the elements that get new values from the
heap, and simply re-insert them, but I cannot find a function
that can allow me to remove an arbitrary element
Use-case is implementing Visvalingam's algorithm for shape
simplification. I need to always select the element (point on
shape) of lowest value (area between it and 2 surrounding
points), but doing so changes the value (area) of the 2
surrounding points, and they have to be repositioned in the heap..
More information about the Digitalmars-d-learn
mailing list