algorithms

How To Do Stacks In JavaScript

Introduction This is a series where you will learn about singly linked lists in JavaScript, doubly linked lists, stacks, and queues. The other links Are Here: How To Do Singly Linked Lists in JavaScript How To Do Stacks in JavaScript (This post) How To Do Doubly Linked Lists in JavaScript (Coming Soon) How To Do Queues in JavaScript (Coming Soon) What is a Stack? A stack is a abstract data structure that holds a list of components (such as a linked list of nodes). Think of it like a stack of dishes. You stack the dishes, so the last one...

Continue reading...

How To Do Singly Linked Lists in JavaScript

Introduction This is a series where you will learn about singly linked lists in JavaScript, doubly linked lists, stacks, and queues. The other links Are Here: How To Do Singly Linked Lists in JavaScript (This post) How To Do Stacks in JavaScript (Coming Soon) How To Do Doubly Linked Lists in JavaScript (Coming Soon) How To Do Queues in JavaScript (Coming Soon) What is a Linked List? A linked list is an abstract concept in which you have a “node” object that references the next object (which is a property within that node) and has a value property. The object...

Continue reading...

OOP VS FP Styles of Programming

OOP VS FP is a topic that has been going around for a while, in this blog post I hope to clear up what OOP is (object oriented programming) and what FP is (functional programming). There is a debate on which is better, OOP VS FP. This post hopes to clear up misunderstandings of either and educate a little bit more about the two. OOP – Object Oriented Programming What is it? Object Oriented Programming (OOP) is a style of programming in which uses classes, inheritance, etc. to keep it’s methods tied to an object. This style of programming makes...

Continue reading...

What are Closures in JavaScript?

Closures in JavaScript is where your function can “remember” the lexical scope — even when the function is ran outside of the scope. Instances of similar occurrences like this can be seen in Object Oriented Programming (OOP). In OOP, you can create an instance of the class object and access it. This functions in a similar way. This is called: Closures in JavaScript. First, let’s dive into what “lexical scope” is and the significance of its role in closures. Lexical Scope Scope is lexical, meaning it can be accessed only on the block of code in which it is defined....

Continue reading...

What are Code Design Patterns?

A “Code Design Pattern” is a re-usable pattern that is used to solve problems with code. This happens on a design level in software, and ultimately makes code easier to manage, and more efficient in some cases. From algorithms to LeetCode patterns, Code Design patterns even go as broad as entire ways to design an entire system and how it relates to other internal systems. Why should I care about Code Design Pattern? Design patterns can accelerate the development process. When you try to solve something without a pattern, you are actively trying to reinvent another pattern that someone else...

Continue reading...

for(;i–;) (JavaScript for loop explained)

This JavaScript for loop is something I came across the other day solving problems in LeetCode. What seemed like an easy problem was difficult as to understanding different ways to combine a set of stairs. Here’s a picture of the problem on LeetCode (the algorithm problem): Solving the for loop So, to solve something like this, there needed to be a form of loop as to the number of times, and then adding exponentially a number that counts the amount of times. So without going much further, here is a solution to this problem: Understanding the JavaScript loop versions So,...

Continue reading...

Space Complexity & How to work on it

Introduction to space complexity Space complexity is how much memory an algorithm takes when executing it’s set of instructions. Usually, time complexity is much more important in a business perspective (quicker results to the client, and we can just buy more hard drive room). However, making sure that you are not taking up too much space is also just as important. Why should I care? When computers evolve, so do the problems we need to solve using the algorithms. The data continuously grows over time, and so does the demand. We also do not want to overload or run out...

Continue reading...

How to Do Recursion in JavaScript (The Basics)

Recursion in JavaScript (and any other language as well) is where you create a function, and then have that function call itself recursively to solve a problem. Think of it as an alternate method of looping through some data or related. It’s common in the algorithm area for you to use recursion to solve some types of problems. In this post, I will outline the basics of solving some simple recursion problems as an introduction to those unfamiliar. The Recursion Problem Okay, so an example of a problem you could solve in recursion with JavaScript is getting the length of...

Continue reading...

Why your projects will never be finished

So chances are you’ve known this, but I’ll tell you in case you’re trying to get it.. your projects and websites will never be finished. You work as an engineer is heavily wrapped in endless task lists that seem to grow by the day. The websites you are developing never seem to come closer to completion. And just as you complete one more thing on the list: another thing appears on the list. Projects Evolve The great thing about the never ending development cycle is that the project will evolve… constantly. This gives you an advantage over your competitors. They...

Continue reading...

A Brief Origin Story of JavaScript

So for those of you who don’t know.. Here’s a short history on the brief origin story of JavaScript. It’s story time! The JavaScript Story: In 1995, JavaScript was written in just 10 days by a man with the name of: Brendan Eich. At the time, Brendan Eich was 34 years old, and he wrote JavaScript with Netscape. It was supposed to be a scripting language for use with the company’s flagship web browser, Netscape Navigator. Initially called LiveScript, it was the first programming language for the browser that allowed programs to run in the browser. There were many security...

Continue reading...