Image for post
Image for post
Photo by Markus Spiske on Unsplash

Algos, algos, algos: the cornerstone of a competent software engineer. This is why I’m compiling all my research and work on the topic in a series of articles titled Algorithm Action.

Today, we’re wrapping up our exploration of Object Oriented Programming in Javascript.

Class Methods

In part one, I covered how Javascript handles Object Oriented Programming without actually being an OOP-based programming language. We covered classes, constructors, and instance method. Now, we’re diving a little more deeply into class methods.

What are they?

Also known as static methods, class methods are used only with entire classes rather than instances of that class. …

Image for post
Image for post
Photo by Luca Bravo on Unsplash

Algos, algos, algos: the cornerstone of a competent software engineer. This is why I’m compiling all my research and work on the topic in a series of articles titled Algorithm Action.

Today, we’re exploring using Object Oriented Programming in Javascript.

What is it?

Technically, Javascript doesn’t support OO programming but in 2015 introduced the Class syntax. A Class is a blueprint for creating objects with predefined properties and methods.

That’s cool, but why should I care?

We’ll be using the Class syntax to define data structures.

How does it work?

The class keyword creates a constant. (Keep in mind you cannot redefine it.) The method to create new objects must be called constructor and serves to give an opportunity for attributes to be defined on instantiation. …

Image for post
Image for post
Photo by Warren Wong on Unsplash

Algos, algos, algos: the cornerstone of a competent software engineer. This is why I’m compiling all my research and work on the topic in a series of articles titled Algorithm Action.

Today, we’re wrapping up our exploration of merge sort.

Previously on Algorithm Action…

In Part 1 of this series, we explored why we need a helper function to make merge sort work and defined it.

function merge(arr1, arr2){ 
let results = [];
let i = 0;
let j = 0;
while (i < arr1.length && j < arr2.length) {
if (arr2[j] > arr1[i]) {
results.push[arr1[i]];
i++;
} else {
results.push(arr2[j]);
j++;
}
}
while (i < arr1.length) {
results.push(arr1[i]);
i++
}
while (j < arr2.length) {
results.push(arr2[j]); …

Image for post
Image for post
Photo by Noah Windler on Unsplash

Algos, algos, algos: the cornerstone of a competent software engineer. This is why I’m compiling all my research and work on the topic in a series of articles titled Algorithm Action.

Today, we’re beginning our exploration of merge sort.

What is it?

Merge sort is a combination of splitting, sorting and merging actions. It works because it exploits the fact that arrays of 0 or 1 element are always sorted. Therefore, by decomposing an array into smaller arrays of 0 to 1 elements, it’s possible to build up a newly sorted array.

But to make it work, let’s take a quick detour to define the helper function we’ll need to make this work. …

Image for post
Image for post
Photo by Jan Antonin Kolar on Unsplash

Algos, algos, algos: the cornerstone of a competent software engineer. This is why I’m compiling all my research and work on the topic in a series of articles titled Algorithm Action.

Today, we’re checking out a specific sorting pattern known as selection sort.

What is it?

Selection sort is similar to bubble sort, but instead of first placing large values into sorted position, it places small values into sorted position.

Interesting, but what’s the pseudocode like?

Let’s wrap our head around this one:

1. Store the first element as the smallest value you’ve seen so far in the given array. So if that’s 2, this variable will be equal to 2.
2. Compare this variable to the next element in the array until you find a smaller number.
3. If a smaller number is found, designate that smaller number to be the new minimum and continue until the end of the array.
4. If the minimum is not the value(index) you began with, swap the values.
5. …

Image for post
Image for post
Photo by Possessed Photography on Unsplash

Algos, algos, algos: the cornerstone of a competent software engineer. This is why I’m compiling all my research and work on the topic in a set of articles titled Algorithm Action.

Today, we’re checking out a specific sorting pattern known as naive search.

What is it?

Naive search is more of a brute force method of finding strings inside of other strings, or any other problem like it, for example.

How does it work?

Naive search is pretty straightforward, using two for loops to go through each string and increment a matchCount as matches are found.

Let’s first define a function that takes two strings:

function naiveSearch(long, short) {…
Image for post
Image for post
Photo by Clem Onojeghuo on Unsplash

Algos, algos, algos: the cornerstone of a competent software engineer. This is why I’m compiling all my research and work on the topic in a set of articles titled Algorithm Action.

Today, we’re checking out a specific sorting pattern known as binary search.

What is it?

Binary search is a much faster form of search. Instead of eliminating one element at a time, you eliminate half of the remaining elements each time a certain condition is met. The one caveat, however, is that binary search only works on sorted arrays. …

Image for post
Image for post
Photo by Daniele Levis Pelusi on Unsplash

Algos, algos, algos: the cornerstone of a competent software engineer. This is why I’m compiling all my research and work on the topic in a set of articles titled Algorithm Action.

Today, we’re checking out a specific sorting pattern known as bubble sort.

What is it?

Bubble Sort if an algorithm where the largest values “bubble” to the top. While it’s not commonly used or very efficient, it does work in niche situations. In the category of sorting algorithms, it’s especially important to know what each type does and in what situations they perform optimally. …

Image for post
Image for post
Photo by Michael Dziedzic on Unsplash

Algos, algos, algos: the cornerstone of a competent software engineer. This is why I’m compiling all my research and work on the topic in a set of articles titled Algorithm Action.

Today, we’re checking out a specific problem solving pattern known as the sliding window.

You Mean That Gwyneth Paltrow Movie?

Image for post
Image for post
Photo by Anthony Intraversato on Unsplash

Algos, algos, algos: the cornerstone of a competent software engineer. This is why I’m compiling all my research and work on the topic in a set of articles titled Algorithm Action.

Today, we’re checking out a specific problem solving pattern known as divide and conquer.

Take Command Of Divide & Conquer

The Divide & Conquer approach is important because, for a lot of problems, it usually greatly decreases time complexity. It involves dividing a data set into smaller chunks, applying some sort of condition to both, and then repeating the process with whichever subset of data passes, and on and on. …

Nicholas Echevarria

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store