A d-ary min heap with n elements has the following time complexity:
Insertion.O((logn)/(logd)).
Extract-Min.O(d⋅(logn)/(logd)).
Decrease-Key.O((logn)/(logd)).
Recall that for a single source shortest path query on a graph with n vertices and m edges, the Dijkstra's Algorithm performs n extract-min operations, and m decrease-key operation.
Working with d-ary min heap, it has time complexity
O(n⋅d⋅logdlogn+m⋅logdlogn)
Setting d=m/n minimizes this to
O(m⋅logm/nn)=O(m⋅log(m/n)logn).
Consider the following cases:
m=O(n), then the time complexity is O(nlogn).
m=Θ(nlogn), then the time complexity is
O(n⋅(logn)⋅loglognlogn).
Example:
when n=220=1M, (logn)/(loglogn)=20/(log20)≈4.6.
when n=230=1G, (logn)/(loglogn)=30/(log20)≈6.1.
m=Θ(n1+ϵ) for some ϵ>0, then the time complexity is