# Binary Heaps in JS

Having covered data structures for some time now, I’ve been able to make a lot of comparisons. Recently I’ve learned more about the power of binary heaps when it comes to insertion, and quickly accessing the minimum or maximum element in your data. The power of binary heaps lies in the fact that they keep the data sorted by value. There are two different kinds of binary heaps, a max or a min.

In a max binary heap you start with the largest value on top and then work down from there. The nodes below should continually get smaller and…

# Spiral Matrix in JavaScript

This week while covering JavaScript algorithms I came across one question that had me completely stumped. The task was to create a function that would output a spiral matrix that was size n of n. Admittedly, when I heard the word matrix my brain instantly started racing. After long thought, I eventually came across a solution and now the problem doesn’t seem quite as challenging. In this article I’ll walk through my implementation of creating a spiral matrix in JavaScript.

To start, we’ll need to write a function that accepts an argument of an integer. This integer will determine the…

# Graphs in JavaScript

If you cover data structures in programming you will inevitably come across graphs. A graph is a non-linear data structure that is comprised of vertices, also known as nodes. These vertices are then connected by “edges” which can either have a single direction or go both directions. Graphs have multiple applications in software. They can be useful for social networks, map navigation, browsing the web or even organizing the processes of your computers operating system. For these reasons, focusing on the implementation of graphs and developing algorithms to work with them is a critical concept in computer science.

There are…

# Binary Trees

This week while diving further into coding interview questions, I took a deeper look at data structures, particularly trees. In programming, trees are a non linear data structure, they instead maintain data in a hierarchical way. Similar to other structures however, they are comprised of a bunch of nodes that contain pieces of data. Every tree has a “root node” and from this root node, children nodes are branched off and connected by edges. Once we traverse to the bottom of a tree, these bottom level nodes are called leaves. You can picture this data structure as a real life…

# Basic JavaScript Sorting Algorithms

This past week I spent a good amount of my time studying sorting algorithms. I mainly focused on the basic sorting algorithms such as Bubble Sort, Selection Sort, and Insertion Sort. I quickly learned that these are useful stepping stones to learn more about sorting algos. However, they’re considered basic because they don’t have the best runtimes, making them not the best choice for production applications. All of these ‘basic’ algorithms have a Quadratic O(n²) time complexity.

First off is Bubble Sort. This algorithm loops through a collection of data, comparing two values at a time. It determines which item…

# Queue In JavaScript

As I continue my coding journey, I’ve been focused on learning more about data structures. I recently took a deeper dive into queues and their implementation. Seeing the term ‘queue’ on platforms such as Youtube has definitely added to my curiosity as a new programmer. Similar to other data structures, a queue is simply a collection of data that forms a line-like structure. In terms of accounting, it follows the FIFO (First In First Out) principle. Items can only be added to the back of the queue and only be accessed once they are in the front. …

While prepping for my first interview, I spent a lot of time covering data structures as I understand they’re a very popular topic in interview questions. I was familiar with the concept of Linked Lists, but not completely comfortable with my understanding. I thought how better to learn more about them than to create one from scratch. Since I primarily code in JavaScript and they don’t have Linked Lists, I created one using a JavaScript class.

A Linked List is a data structure that has three common types: Singly, Doubly, or a Circular Linked List. It is very similar to…

# Big O Time Complexity

After graduating from my Software Engineering program at Flatiron school, I’ve been adjusting to the world of self teaching. One thing however, became evidently clear within the couple months leading up to graduation. Through the program and side courses I’ve taken, I know how to write code. But what separates good code from great code? Throughout my bootcamp we were taught to maintain the DRY principle (Don’t Repeat Yourself). This is a strong foundation for writing good code but as I quickly learned, that’s not all there is to it. …

# Fibonacci, Recursion & Memoization

For the past year and half I’ve been in an ongoing cycle. I learn something programming related, and I leave with 20 more questions and new concepts to dive into. This recently happened while going over coding interview questions. I was covering the notorious Fibonacci sequence, and had the chance to learn more about memoization and recursion.

For those of you who aren’t familiar with the Fibonacci sequence, it’s a set of numbers where each new number is the sum of the previous two. The start of the sequence is [0, 1, 1, 2, 3, 5, 8, 13, 21,….]. For…

## Trejon Stallsworth

Get the Medium app