CST 370 - Week 7

 Hey everyone,

This week’s learning journey took me through several important algorithmic techniques and problem-solving strategies, expanding both my theoretical knowledge and my practical skills.

I began with Non-Comparison Sorting, where I explored Counting Sort and Radix Sort. Unlike traditional comparison-based methods like Merge Sort or Quick Sort, these algorithms leverage properties of the input data to achieve better-than-O(n log n) performance in certain cases. Counting Sort uses frequency counting to sort integers efficiently, while Radix Sort applies a digit-by-digit sorting approach (often using Counting Sort as a subroutine), making it especially useful for fixed-length integers or strings. The visualizations helped me understand how these algorithms maintain stability and avoid element comparisons altogether.

Next, I dove into Dynamic Programming (DP). The key takeaway was that DP is all about solving complex problems by breaking them into overlapping subproblems, storing solutions to avoid redundant work. I practiced with the Coin-Collecting problem, which reinforced the idea of building solutions from smaller optimal sub-solutions, and the Coin-Row problem, which highlighted how DP applies to optimization tasks with constraints (e.g., not taking adjacent coins). The concept of a “table” or array to store intermediate results became very clear during these exercises.

From there, I moved into graph algorithms. I learned Warshall’s Algorithm, which computes the transitive closure of a graph by progressively checking whether paths exist through intermediate vertices, and Floyd’s Algorithm, which finds the shortest paths between all pairs of vertices by iteratively improving distance estimates. Both reinforced the power of systematic, table-based iterative updates.

Finally, I studied the Greedy Technique through Prim’s Algorithm for finding a Minimum Spanning Tree. This was a great contrast to DP: instead of storing and reusing solutions, greedy algorithms build the solution step-by-step, always making the locally optimal choice in the hope it leads to a globally optimal one. Prim’s method showed how simple decisions (adding the cheapest available edge) can still yield optimal solutions for certain problems.

Discussion Tip:
I had even shared a discussion tip on the class forum on Discord:
" Hey everyone, I just wanted to share one tip that has helped me in this week's homework as well as studying for the final is that when learning new algorithms, try to connect them to problems we’ve already solved in a different way. For example, after studying Floyd’s Algorithm, I tried to compare it to running Dijkstra’s Algorithm from every vertex. This not only deepens understanding but also highlights why certain algorithms are preferred for specific scenarios."

Overall, this week helped me appreciate how different algorithmic strategies—non-comparison sorting, dynamic programming, greedy methods—are suited to different types of problems. Each approach offers its own balance of efficiency, complexity, and problem-solving style.

Comments

Popular posts from this blog

CST 370 - Week 1

CST 370 - Week 5

CST 370 - Week 4