digitalmars.D.learn - change value of item in BinaryHeap
- =?UTF-8?B?IsOYaXZpbmQi?= (12/12) Apr 27 2014 I am trying to figure out how to change the value of an element
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..
Apr 27 2014