Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
t-c-chiu opened this issue Aug 8, 2019 · 0 comments

Comments

@t-c-chiu
Copy link

t-c-chiu commented Aug 8, 2019

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

if (queue[i] == moved) {
    siftUp(i, moved);
 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant