algorithms on Aos Dabbagh
/tags/algorithms/
Recent content in algorithms on Aos DabbaghHugo -- gohugo.ioen-usWed, 26 Dec 2018 18:25:56 -0500A Simple Dynamic Programming Algorithm
/2018/12/26/a-simple-dynamic-programming-algorithm/
Wed, 26 Dec 2018 18:25:56 -0500/2018/12/26/a-simple-dynamic-programming-algorithm/Introduction For the past month or so I’ve spent time digging into dynamic programming (hereby abbreviated to DP). There many great resources introducing the history and concepts of DP. However, what I wanted was the simplest example/demonstration of how DP works. Most examples were too convoluted for someone just learning it such as myself.
Luckily, while working through Advent of Code, I ran into a puzzle that led me down a rabbit hole to find the simplest example of DP.Understanding Dijkstra's Algorithm
/2018/02/24/understanding-dijkstras-algorithm/
Sat, 24 Feb 2018 01:02:57 -0500/2018/02/24/understanding-dijkstras-algorithm/Introduction When I first started learning algorithms and data structures, every resource I came across would mention Dijkstra’s algorithm in a sort of mystical, this-is-beyond-your-lowly-understanding manner. I disagree with that approach (in fact, I disagree with that approach for just about everything). Now that I’ve actually invested some time into learning it, it really isn’t as frightful as I was told to believe. I will (to the best of my ability) elucidate Dijkstra’s algorithm here.Computing Strongly Connected Components
/2017/12/09/computing-strongly-connected-components/
Sat, 09 Dec 2017 16:20:45 -0500/2017/12/09/computing-strongly-connected-components/Introduction I am currently working through Stanford’s algorithms course as part of “learning my fundamentals”, and one difficult and interesting topic that I’ve encountered is computing strongly connected components of a directed acyclic graph.
A graph is said to be strongly connected if every vertex is reachable from every other vertex. In the image below, you will notice that the left graph is strongly connected, but the right one is not – vertex H acts as a sink for every vertex with a connection and it is not possible to reach any other vertex from here.