Current HeapPriorityQueue calls add for each element in the given Iterable yielding a time complexity of $O(n * logn)$, but if the heapify algorithm is used instead the time complexity can be reduced to $O(n)$. This has been done in other languages such as Go for example: https://cs.opensource.google/go/go/+/refs/tags/go1.23.4:src/container/heap/heap.go;l=41
Current$O(n * logn)$ , but if the heapify algorithm is used instead the time complexity can be reduced to $O(n)$ . This has been done in other languages such as Go for example: https://cs.opensource.google/go/go/+/refs/tags/go1.23.4:src/container/heap/heap.go;l=41
HeapPriorityQueuecallsaddfor each element in the given Iterable yielding a time complexity of