JCFInternals icon indicating copy to clipboard operation
JCFInternals copied to clipboard

關於PriorityQueue的remove情況2應該還有其他情形需要處理?

Open t-c-chiu opened this issue 5 years ago • 0 comments

以範例那張圖為例 假設remove的是15 也就是index=5的那個元素 在siftDown後那個位置會變成9, heap不對, 因此應該還需要檢查

if (queue[i] == moved) {
    siftUp(i, moved);
 }

t-c-chiu avatar Aug 08 '19 02:08 t-c-chiu