From 415c6bc3925ffbe60f4ce3034bfdf77e6c733e49 Mon Sep 17 00:00:00 2001 From: Joseph Ferano Date: Mon, 23 Jan 2023 12:03:21 +0700 Subject: [PATCH] Few more Chapter 6 notes --- TheAlgorithmDesignManual.org | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/TheAlgorithmDesignManual.org b/TheAlgorithmDesignManual.org index ccdab69..9a135f8 100644 --- a/TheAlgorithmDesignManual.org +++ b/TheAlgorithmDesignManual.org @@ -1092,3 +1092,25 @@ Salesman Problems ** 6.3 Shortest Paths +In an unweighted graph, BFS will find the shortest path between two nodes. For +weighted graphs the shortest path might have many more edges. Dijstra's +algorithm can help us find the shortest path in a weighted path. It runs in +O(n^{2}) time. One caveat is that it does not work with negative weighted edges. + +#+begin_src C :includes stdio.h stdlib.h + +#+end_src + +Another problem in this space is the all-pairs shortest path, and for this we +would use the O(n^{3}) Floyd-Warshall algorithm which uses an adjacency matrix +instead since we needed to construct one anyway to track all the possible pairs. +It's a useful algorithm for figuring out /transitive closure/ which is a fancy way +of asking if some vertices are reachable from a node. + +** 6.4 War Story + +Kids are probably young to know what the author is even talking about with these +phone codes. + +** 6.5 Network Flows and Bipartite Matching +