diff options
author | Valery Piashchynski <[email protected]> | 2021-07-05 12:29:41 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2021-07-05 12:29:41 +0300 |
commit | 300166eda7b138847008a7653f90753bd8397b9e (patch) | |
tree | 846f39c16caca0f435957f030f6e7005edaf6da0 /pkg/priority_queue/binary_heap.go | |
parent | 01ba1da722660fa59da4b75af3ff68ce3d5c4f5a (diff) |
- Update PQ tests
Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'pkg/priority_queue/binary_heap.go')
-rw-r--r-- | pkg/priority_queue/binary_heap.go | 13 |
1 files changed, 0 insertions, 13 deletions
diff --git a/pkg/priority_queue/binary_heap.go b/pkg/priority_queue/binary_heap.go index 00c73869..02d413aa 100644 --- a/pkg/priority_queue/binary_heap.go +++ b/pkg/priority_queue/binary_heap.go @@ -10,19 +10,6 @@ func NewBinHeap() *BinHeap { return &BinHeap{} } -func (bh *BinHeap) Init(items []PQItem) { - arraySize := len(items) - 1 - - for i := arraySize/2 - 1; i >= 0; i-- { - bh.fixDown(i, arraySize) - } - - for i := arraySize - 1; i >= 1; i-- { - items[0], items[i] = items[i], items[0] - bh.fixDown(0, i-1) - } -} - func (bh *BinHeap) fixUp() { k := len(*bh) - 1 p := (k - 1) >> 1 // k-1 / 2 |