title: How to update elements within a heap? (priority queue)
body: <p>When using a min/max-heap algorithm, priorities may change. One way to handle this is to removal and insert the element to update the queue order.</p>
  
  <p>For priority queues implemented using arrays, this can be a performance bottleneck that seems avoidable, especially for cases when the change to priority is small.</p>
  
  <p><a href="https://stackoverflow.com/questions/42607062">Even if this is not a standard operation for a priority queue</a>, this is a custom implementation which can be modified for my needs.</p>
  
  <p>Are there well known best-practice methods for updating elements in the min/max-heap?</p>
  
  <hr>
  
  <p><em>Background Info: I'm no expert in binary-trees, I inherited some code that has a performance bottleneck re-inserting elements in a priority queue. I've made a re-insertion function for the min-heap that re-orders the new element - which gives a measurable improvement over (remove &amp; insert), however this seems the kind of problem that others may have solved in a more elegant way.</em></p>
  
  <p><em>I could link to the code if it helps but would rather not focus too much on implementation details - since this Q&amp;A can probably be kept general.</em></p>