The time complexity for initializing a PriorityQueuefrom a collection, even unsorted, is O (n). Internally, it uses a procedure called siftDown()to "heapify" the array in place. (This is also called pushdown in the literature.)
. , - O (log n), n O (n log n). , . (, siftUp().)
- , , O (log n), "" siftDown() , , , . , n times log (n); n .
. , , .