CST370 - Week 7
CST370 Week 7 (& 8?) This week we learned about dynamic programming and how to use backtracking to find optimal solution paths. Instead of brute-forcing through all solution paths, dynamic programming uses a solution array that keeps track of already-calculated sub-problems in a table. Once we hit the end, we can use that table to backtrack and find the solution to the problem. We also learned about Warshall's algorithm, which uses transitive closure to find paths from one vertex to a non-adjacent vertex in a directed graph, and Floyd's algorithm to further apply this to find the all-pairs shortest-paths matrix solution of a connected cyclic graph. The solution to Warshall's algorithm is a matrix of 0s and 1s showing if a valid path from one vertex to another is possible. If the path (row) has all 1s across, a path from that vertex (row index) can be traced to all vertices, including itself if it is part of a cycle. The solution to Floyd's alg...