I am trying to run a simple example code from the DataStructures.jl package but I get an error.
data = collect(enumerate(["foo", "bar", "baz"]))
h1 = BinaryHeap(data) # Standard lexicographic ordering for tuples
first(h1) # => (1, "foo")
h2 = BinaryHeap(Base.By(last), data) # Order by 2nd element only
first(h2) # => (2, "bar")
ERROR: MethodError: no method matching BinaryHeap(::Vector{Tuple{Int64, String}})
Closest candidates are:
BinaryHeap(::Base.Order.Ordering, ::AbstractVector{T}) where T at ~/.julia/packages/DataStructures/59MD0/src/heaps/binary_heap.jl:47
Stacktrace:
[1] top-level scope
@ ~/Desktop/ShortestPath/heaptest.jl:4
I have been checking online, some people solved the problem by renaming the environment, others had to update the packages. But I still cannot make this work. If anyone has an idea I will be really grateful, I wrote a code that was working perfectly were the main line is precisely a BinaryHeap.
Thanks