Quantcast
Channel: First steps - JuliaLang
Viewing all articles
Browse latest Browse all 2795

Create a heap for array with weights

$
0
0

Suppose that I have an array

X = ["a","b","c","d"]

with the corresponding weights

weight = [1,4,3,2]

How can I make heaps of X using weight

using DataStructures
weight_heaps =BinaryMaxHeap(weight)
# What I want to do
X_heaps = BinaryMaxHeap(X,weight=weight)

I can not find it in the DataStructures package documentation. Thank you so much.

2 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 2795

Latest Images

Trending Articles



Latest Images