I found this little challenge in a puzzle booklet and instantly thought "I wonder if I can get a computer to figure this out for me?". Not long after that first thought, I had a second thought "I wonder if I can get a computer to give me the LONGEST chain of words!". The source code for this project is on Github . Version 1: Find Longest Path I figured that finding the longest chain will probably take a lot of compute, so designing for performance was a priority. Dictionary words We need a list of English words and we need to be able to quickly check if a word of a certain length is a real word. For this, I created a hashmap where the key is the length of words and the values are a set of all words of that length. A set gives us constant-time lookups, which we definitely need. Search Algorithm Next, I needed to decide an overall approach to take to find the longest path. For this, I decided to use a depth-first-search algorithm. This algorith...
Karl's Blog
Tackling life’s serious issues with engineering