Rules of Dijkstra’s Algorithm Flashcards
Rule 1 Dijkstra’s algorithm
We make the starting vertex our current vertex.
Rule 2 Dijkstra’s algorithm
We check all the vertices adjacent to the current vertex and calculate and record the weights from the starting vertex to all known locations.
Rule 3 Dijkstra’s algorithm
To determine the next current vertex, we find the cheapest unvisited known vertex that can be reached from our starting vertex.
Rule 4 Dijkstra’s algorithm
Repeat the first three steps until we have visited every vertex in the graph.
Data structures operations
Read, Search, Insert, Delete
Array Search Worst Case
N steps
Array Insertion Worst Case
N + 1 steps
Array Deletion Worst Case
N steps
Set Search Worst Case
N steps
Set Insertion Worst Case
2N + 1 steps
Set Deletion Worst Case
N steps
Ordered Arrays
Sorted
O(log N)
the Big O way of describing an algorithm that increases one step each time the data is doubled
Compaction
means throwing away duplicate keys in the log, and keeping only the most recent update for each key
Bubble Sort
O(N^2)