Find a path between two nodes in a graph such that the sum of the weights of its constituent edges is minimized.
Note: This is the second post I’ve written on this topic. In the previous post, I implemented a breadth first search to traverse from one node in a binary tree to another. If you aren’t super familiar with navigating node based data structures, want a quick refresh, or want to see an unnecessary amount of slime mold gifs, I recommend checking it out before diving into this solution!
Find a path between two nodes in a tree using Breadth First Search
I’m going to be honest: I decided to tackle this problem because I wanted to talk about slime molds.
Slime molds are weird. They aren’t molds, actually — they used to be classed as fungi, but are no longer. They also aren’t plants, animals, or minerals. They can move. They can be single-celled organisms, or form massive, sludgy colonies.
Slime molds are now classified as protists, which is largely a grouping of convenience, as protists don’t share common ancestry, aren’t necessarily related, and don’t really have that…
Given an array of strings, return a new array containing all the strings with any anagrams collected together.
When I saw this challenge, I thought it might be a good application for one of my favorite problem-solving data structures: the lowly hash table.
“color”: “green” would be a property, or key-value pair. This makes the stored data accessible in a new way…
Given two integers which are not both zero, find the largest positive integer that divides into evenly into each of the integers.
Most of the digital tools we use every day rely on encryption. Somewhere in their architecture, sometimes many times or many places, web apps use RSA encryption to control authorization & authentication, secure stored data, and more.
Yet, these encryption processes frequently utilize a version of one of the oldest recorded algorithms in common use — the Euclidean Algorithm.
Algorithms go back a long way.
While we generally talk about algorithms in the context of mathematics or computer…
Generate a complete list of prime numbers up to a given number.
I love working with prime numbers.
Given an array of numbers, find the contiguous subarray within it which adds up to the largest sum.
Want to analyze some DNA? Sequence a genome? Analyze image data? Doing some data mining? Or maybe just brushing up on algorithms while preparing for technical interviews? Then you might need to find the subarray in an array of numbers that adds up to the largest sum.
What is the aim of the Balanced Brackets algorithm challenge?
“Given a string containing brackets, determine if all brackets have a matching counterpart. If all brackets in the string form balanced pairs, return true. If not, return false”
What is the Ransom Note challenge?
‘Given two strings:
1. A source string, i.e. the “page”
2. A desired string, i.e. the “note”
determine if the desired “note” string can be created using only the letters found in the source “page”.’
A visual example of what we’re looking for would be this:
Given a string, return all permutations of the string.
When I sat down to solve this problem, I found it to be a great algorithm challenge. Why? While the task of manipulating a string may seem familiar on its surface, actually finding a complete solution requires us to handle some unexpected complexity, which provides the opportunity to utilize a recursive tree and build a bit of familiarity with the master theorem.
What is the Two-Sum Problem?
“Given an array of integers and a target number, return the two integers that add up to the target number”
NYC based Elixir + Graphql + React engineer. When I was a beginner programmer, I was frustrated by the lack of JS algo solutions, so I wrote these. [they/them]