Week 9 - Algorithms for the exam

OMSCS
algorithmproblemruntimeNotes
DFS to find path in a directed graphFind path in a directed graph$O(\vert V \vert + \vert E \vert)$Not shortest
DFS to find path in an undirected graphFind path in undirected graph$O(\vert V \vert + \vert E \vert)$Not shortest
DFS to find connected components in an undirected graphFind connected components in a undirected graph$O(\vert V \vert + \vert E \vert)$
BFSFind path in undirected graph/Find path in a directed graph$O(\vert V \vert + \vert E \vert)$Shortest unweighted
Dijkstra’s algorithmFind path in undirected graph/Find path in a directed graph$O((\vert V \vert + \vert E \vert) \log(\vert V \vert))$shortest weighted, positive weights only, from source
Bellman-Ford algorithmFind path in undirected graph/Find path in a directed graph$O(\vert V \vert \vert E \vert)$shortest weighted, from source, detects negative cycles
Floyd-Warshall algorithmFind path in undirected graph/Find path in a directed graph$O(\vert V \vert^3)$shortest weighted, all nodes, detects negative cycles
DFS for finding strongly connected componentsFind strongly connected components for an undirected graph$O(\vert V \vert + \vert E \vert)$Outputs them with topologically sort
Kruskal’s algorithmMST$O(\vert E \vert \log(\vert V \vert))$
Prim’s algorithmMST$O(\vert E \vert \log(\vert V \vert))$
Ford-Fulkerson Algorithmmax flow$O(C \vert E \vert)$ $C$ being the max flowInteger weights
Edmonds-Karp algorithmmax flow$O(\vert V \vert \vert E \vert^2)$
2-SAT algorithm using SCC2-SAT$O(\vert V \vert + \vert E \vert)$