Port BinaryHeap to Scala