-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed
Labels
Description
Documentation( http://golang.org/pkg/container/heap/#Fix ) states:
"Fix re-establishes the heap ordering after the element at index i has changed its value."
A simple test proves that this functionality is broken. Add 10 numbers 0->9 and the heap will look like this:
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
Change heap[9] to 0 making the heap look like this:
[0, 1, 2, 3, 4, 5, 6, 7, 8, 0]
Call heap.Fix(9) and the heap looks like this:
[0, 0, 2, 3, 1, 5, 6, 7, 8, 4]
Reactions are currently unavailable