Find a

pathbetween 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 much in common besides being made of eukaryotic cells, and not fitting into any of the other groups. …

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.

In JavaScript, hash tables can be used through *objects*** **(not this type of JavaScript Objects) where key-value pairs, or properties, are enclosed by curly braces (i.e. {these guys}) and can be accessed via each other.

For example:

“color”: “green” would be a property, or key-value pair. This makes the stored data accessible in a new way. If I wanted to look up “green”, for example, I wouldn’t need to iterate through, searching for a match for “green. I could go straight to apple.color …

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 programming, they aren’t limited to those contexts. …

Generate a complete list of prime numbers up to a given number.

I love working with prime numbers.

Why?

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.

This challenge is one of my favorite illustrations of the value of using the right tools to solve a problem. As web developers, we often use many of the same design patterns to solve problems over and over. Which is great! Learning efficient templates allows us to solve many of the problems we encounter more quickly and effectively. …

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.

*Note**: There is more than one way to solve this problem. The solution model I explore here utilizes tools and concepts that I find broadly valuable for the solution of **algorithmic challenges**, and methods that I find intuitive for string manipulation within Javascript.* …

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”