Week07 Complexity Analysis
Linear Search

Binary Search

Binary Search Trees


Dijkstra's Algorithm
Without a priority queue

Thus the time complexity is , which is equivalent to
With priority queue


Relax's
Each vertex is only "visited" (removed from the queue as the vertex with the shortest distance to the source) once. From observations we can find each edge is only checked once at most in Relax(). All edges will be checked, but only a portion of these operations trigger the shortest path update (priority queue update complexity of )
Thus the time complexity is
Last updated