Week 66: CST370 - Design and Analysis of Algorithms
- Get link
- X
- Other Apps
WK07: Weekly Reflection
This week's module focused on dynamic programming, Warshall's algorithm, Floyd's algorithm, greedy techniques, and Prim's algorithm. These topics helped me understand ways to solve optimization and graph problems.
One topic that stood out was dynamic programming. I learned that it works by breaking a problem into smaller overlapping subproblems and reusing previously calculated results instead of solving the same problem again. The Coin-Row problem helped me understand this idea because the goal is to choose coins with the greatest total value without selecting adjacent coins. I also practiced the Coin-Collecting problem, where values are calculated step by step across a grid to find the maximum number of coins that can be collected.
Another important topic was Warshall's algorithm. I learned that it is used to find the transitive closure of a directed graph. It shows whether a path exists from one vertex to another, even when there is no direct edge between them. The exercises helped me understand how the reachability matrix changes as more intermediate vertices are allowed. The Missionaries and Cannibals puzzle also showed how graph states and transitions can be used to represent and solve a problem.
Floyd's algorithm was similar to Warshall's algorithm, but instead of checking reachability, it finds the shortest paths between all pairs of vertices in a weighted graph. I learned how the distance matrix is updated by checking whether traveling through an intermediate vertex creates a shorter path.
The final topic was the greedy technique and Prim's algorithm. I learned that a greedy algorithm makes the best available choice at each step. Prim's algorithm applies this idea to find a Minimum Spanning Tree by repeatedly selecting the lowest-cost edge that connects a visited vertex to an unvisited vertex.
Overall, this week helped me see how different algorithmic strategies are suited to different problems. Dynamic programming reuses solutions to smaller problems, Warshall's algorithm finds reachability, Floyd's algorithm finds shortest paths, and Prim's algorithm builds a minimum-cost spanning tree. My main takeaway is that understanding the structure of a problem helps determine which algorithm is the most appropriate and efficient.
- Get link
- X
- Other Apps
Comments
Post a Comment