[AD] Update summary to new version of helpers

This commit is contained in:
2025-09-26 12:31:55 +02:00
parent 33f034fdd1
commit eecaab61fc
16 changed files with 110 additions and 109 deletions

View File

@@ -27,7 +27,7 @@ We can also use $n$-times dijkstra or any other shortest path algorithm, or any
\begin{properties}[]{Characteristics of Floyd-Warshall Algorithm}
\begin{itemize}
\item \textbf{Time Complexity:} \tco{|V|^3}.
\item \textbf{Time Complexity:} $\tco{|V|^3}$.
\item Works for graphs with negative edge weights but no negative weight cycles.
\item Computes shortest paths for all pairs in one execution.
\end{itemize}
@@ -82,7 +82,7 @@ We can also use $n$-times dijkstra or any other shortest path algorithm, or any
\item Reweight edges to remove negative weights.
\item Use Dijkstra's algorithm for each vertex to find shortest paths.
\end{enumerate}
\item \textbf{Time Complexity:} \tco{|V| \cdot (|E| + |V| \log |V|)}.
\item \textbf{Time Complexity:} $\tco{|V| \cdot (|E| + |V| \log |V|)}$.
\item Efficient for sparse graphs compared to Floyd-Warshall.
\end{itemize}
\end{properties}
@@ -140,8 +140,8 @@ We can also use $n$-times dijkstra or any other shortest path algorithm, or any
\toprule
\textbf{Algorithm} & \textbf{Primary Use} & \textbf{Time Complexity} & \textbf{Remarks} \\
\midrule
Floyd-Warshall & AP-SP & \tco{|V|^3} & Handles negative weights \\
Johnsons Algorithm & AP-SP (sparse graphs) & \tco{|V|(|E| + |V| \log |V|)} & Requires reweighting \\
Floyd-Warshall & AP-SP & $\tco{|V|^3}$ & Handles negative weights \\
Johnsons Algorithm & AP-SP (sparse graphs) & $\tco{|V|(|E| + |V| \log |V|)}$ & Requires reweighting \\
\bottomrule
\end{tabular}
\caption{Comparison of the All-Pair Shortest path (AP-SP) algorithms discussed in the lecture}

View File

@@ -43,7 +43,7 @@
\begin{properties}[]{Depth-First Search}
\begin{itemize}
\item Can be implemented recursively or iteratively (using a stack).
\item Time complexity: \tco{|V| + |E|}, where $|V|$ is the number of vertices and $|E|$ is the number of edges.
\item Time complexity: $\tco{|V| + |E|}$, where $|V|$ is the number of vertices and $|E|$ is the number of edges.
\item Used for:
\begin{itemize}
\item Detecting cycles in directed and undirected graphs.
@@ -81,7 +81,7 @@
\begin{properties}[]{Breadth-First Search}
\begin{itemize}
\item Implements a queue-based approach for level-order traversal.
\item Time complexity: \tco{|V| + |E|}.
\item Time complexity: $\tco{|V| + |E|}$.
\item Used for:
\begin{itemize}
\item Finding shortest paths in unweighted graphs.

View File

@@ -7,8 +7,8 @@
\begin{properties}[]{Characteristics of Strassens Algorithm}
\begin{itemize}
\item \textbf{Standard Multiplication:} Requires \tco{n^3} time for two $n \times n$ matrices.
\item \textbf{Strassens Approach:} Reduces the complexity to \tco{n^{\log_2 7}} (approximately \tco{n^{2.81}}).
\item \textbf{Standard Multiplication:} Requires $\tco{n^3}$ time for two $n \times n$ matrices.
\item \textbf{Strassens Approach:} Reduces the complexity to $\tco{n^{\log_2 7}}$ (approximately $\tco{n^{2.81}}$).
\item \textbf{Idea:} Uses divide-and-conquer to reduce the number of scalar multiplications from $8$ to $7$ in each recursive step.
\item Useful for applications involving large matrix multiplications.
\end{itemize}

View File

@@ -8,8 +8,8 @@
\begin{itemize}
\item \textbf{Graph Type:} Works on undirected, weighted graphs.
\item \textbf{Approach:} Greedy, component-centric.
\item \textbf{Time Complexity:} \tct{(|V| + |E|) \log(|V|)}.
\item \textbf{Space Complexity:} Depends on the graph representation, typically \tct{E + V}.
\item \textbf{Time Complexity:} $\tct{(|V| + |E|) \log(|V|)}$.
\item \textbf{Space Complexity:} Depends on the graph representation, typically $\tct{E + V}$.
\item \textbf{Limitations:} Efficient for parallel implementations but less commonly used in practice compared to Kruskal's and Prim's.
\end{itemize}
\end{properties}

View File

@@ -8,9 +8,9 @@
\begin{itemize}
\item \textbf{Graph Type:} Works on undirected, weighted graphs.
\item \textbf{Approach:} Greedy, edge-centric.
\item \textbf{Time Complexity:} \tco{|E| \log (|E|)} (for sort), \tco{|V| \log(|V|)} (for union find data structure).\\
\timecomplexity \tco{|E| \log(|E|) + |V| \log(|V|)}
\item \textbf{Space Complexity:} Depends on the graph representation, typically \tct{E + V}.
\item \textbf{Time Complexity:} $\tco{|E| \log (|E|)}$ (for sort), $\tco{|V| \log(|V|)}$ (for union find data structure).\\
\timecomplexity $\tco{|E| \log(|E|) + |V| \log(|V|)}$
\item \textbf{Space Complexity:} Depends on the graph representation, typically $\tct{E + V}$.
\item \textbf{Limitations:} Requires sorting of edges, which can dominate runtime.
\end{itemize}
\end{properties}
@@ -127,8 +127,8 @@
\begin{properties}[]{Performance}
\begin{itemize}
\item \textsc{make}$(V)$: Initialize data structure \tco{n}
\item \textsc{same}$(u, v)$: Check if two components belong to the same set \tco{1} or \tco{n}, depending on if the representant is stored in an array or not
\item \textsc{union}$(u, v)$: Combine two sets, \tco{\log(n)}, in Kruskal we call this \tco{n} times, so total number (amortised) is \tco{n \log(n)}
\item \textsc{make}$(V)$: Initialize data structure $\tco{n}$
\item \textsc{same}$(u, v)$: Check if two components belong to the same set $\tco{1}$ or $\tco{n}$, depending on if the representant is stored in an array or not
\item \textsc{union}$(u, v)$: Combine two sets, $\tco{\log(n)}$, in Kruskal we call this $\tco{n}$ times, so total number (amortised) is $\tco{n \log(n)}$
\end{itemize}
\end{properties}

View File

@@ -12,10 +12,10 @@
\item \textbf{Approach:} Greedy, vertex-centric.
\item \textbf{Time Complexity:}
\begin{itemize}
\item With an adjacency matrix: \tct{V^2}.
\item With a priority queue and adjacency list: \tct{(|V| + |E|) \log(|V|)}.
\item With an adjacency matrix: $\tct{V^2}$.
\item With a priority queue and adjacency list: $\tct{(|V| + |E|) \log(|V|)}$.
\end{itemize}
\item \textbf{Space Complexity:} Depends on the graph representation, typically \tct{E + V}.
\item \textbf{Space Complexity:} Depends on the graph representation, typically $\tct{E + V}$.
\item \textbf{Limitations:} Less efficient than Kruskal's for sparse graphs using adjacency matrices.
\end{itemize}
\end{properties}

View File

@@ -29,8 +29,8 @@
\begin{itemize}
\item \textbf{Time Complexity:}
\begin{itemize}
\item \tco{|V|^2} for a simple implementation.
\item \tco{(|V| + |E|) \log |V|} using a priority queue.
\item $\tco{|V|^2}$ for a simple implementation.
\item $\tco{(|V| + |E|) \log |V|}$ using a priority queue.
\end{itemize}
\item Only works with non-negative edge weights.
\item Greedy algorithm that processes vertices in increasing order of distance.
@@ -112,7 +112,7 @@
\begin{properties}[]{Characteristics of Bellman-Ford Algorithm}
\begin{itemize}
\item \textbf{Time Complexity:} \tco{|V| \cdot |E|}.
\item \textbf{Time Complexity:} $\tco{|V| \cdot |E|}$.
\item Can handle graphs with negative edge weights but not graphs with negative weight cycles.
\item Used for:
\begin{itemize}
@@ -161,7 +161,7 @@
\midrule
Handles Negative Weights & No & Yes \\
Detects Negative Cycles & No & Yes \\
Time Complexity & \tco{(|V| + |E|) \log |V|} & \tco{|V| \cdot |E|} \\
Time Complexity & $\tco{(|V| + |E|) \log |V|}$ & $\tco{|V| \cdot |E|}$ \\
Algorithm Type & Greedy & Dynamic Programming \\
\bottomrule
\end{tabular}