Skip to content

Commit

Permalink
don't overwrite values in by heapifed tree
Browse files Browse the repository at this point in the history
  • Loading branch information
rushabh-v committed Dec 11, 2020
1 parent 5aa2e2a commit bb4a8b6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/heaps/mutable_binary_heap.jl
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,10 @@ function _make_mutable_binary_heap(ord::Ordering, ty::Type{T}, values) where T
n = length(values)
nodes = Vector{MutableBinaryHeapNode{T}}(undef, n)
nodemap = Vector{Int}(undef, n)
values = heapify!(values, ord)
valtree = heapify!(values, ord)

i::Int = 0
for v in values
for v in valtree
i += 1
@inbounds nodes[i] = MutableBinaryHeapNode{T}(v, i)
@inbounds nodemap[i] = i
Expand Down

0 comments on commit bb4a8b6

Please sign in to comment.