# Removing Binary Search Tree Node -JavaScript

A binary search tree is a tree where all of the sibling nodes to the left of a parent node have a value less than the value of the parent node and all of the sibling nodes to the right of a parent node have a value greater than or equal to the value of the parent node.

In the diagram above, all of the siblings to the right of the root node have a value greater than the root node (10, 14 and 13 are greater than 8) and all of the siblings to the left have a value…

# Caesar Cipher Solution In JavaScript

Caesar Cipher is a type of encryption where you take letters in the alphabet and shift them a certain number of positions. If we have a string “abc” and we wanted to encrypt it by shifting each letter 5 positions, the new string would be “fgh.” For example, five positions from “a” is “f” (1 shift = “b”, 2 shifts = “c”, 3 shifts = “d”, 4 shifts = “e”, 5 shifts = “f”). When we get to the end of the alphabet we wrap around back to the beginning. …

# Object Oriented Programming

Object Oriented Programming is a programming paradigm that is built upon classes and objects. In essence, it groups together data and functions that are related to one another. This allows for programs to be broken down into simple reusable components.

# Classes and Objects

The two major concepts of Object Oriented Programming are classes and objects. Basically a class is a specific group and an object is a particular instance of that group. For example, say that a school wanted to create of database of its students. Each student would have a list of attributes (name, year, GPA, major). The class would be a…

# Knapsack Problem In JavaScript

The knapsack problem provides us with an array of items. Each item has a weight and a value. We are also given a knapsack capacity which is the maximum weight that the knapsack can hold. Our task is to figure out the highest value of items that we can fit in the knapsack.

For example, if we have three items. The first has a value of 5 and a weight of 2. The second has a value of 2 and a weight of 3. The third has a value of 6 and a weight of 5. The knapsack weight capacity…

# Contains Duplicate Solutions In JavaScript

The contains duplicate problem provides us with an array of elements. We then have to determine if there are any duplicate elements in the array. In this article we will cover three different approaches with varying Big O time complexities.

# Naive/Brute Force

First off there is the naive or brute force approach. Conceptually, we iterate through the array and compare each element to every other element in the array. This can done using a nested for loop. The outer for loop starts at the first element in the array and iterates to the second-to-last element. The inner loop starts at the element…

# Merge Intervals Solution In JavaScript

The Merge Intervals problem provides us with an array of intervals. The intervals are given as arrays of two elements where the first element is beginning value of the interval and the second element is the end value. We then have to combine the intervals which have overlapping values.

Here is an example of an input and the desired result.

The first two intervals are overlapping so we merge them into one interval. The first interval ends with the value of 3 and the second interval starts with the value of 2. Because 2 is less than 3 these intervals…

# Binary Search

A simple way to search for an element in an array is to traverse each element in the array until you find the target element. This can done by using a basic for loop to iterate through the array. While this approach is easy to implement it might not be the most optimal. When we are working with an array that is sorted in ascending or descending order there is much better method that can dramatically decrease our run time.

A common way of describing binary search is looking up someone in the phone book. If we were looking for…

# Removing duplicates from an array using Set (and other Set methods)

A short and easy way to remove duplicates from array is to use Set. Set is an object in JavaScript that allows you to store unique values. Essentially it iterates through the original values and uses an equality check to remove the duplicates.

The first step would be to convert the original array to a Set object.

To create a new Set object simply use the syntax “new Set” followed by the original array as an argument in parentheses as shown above. The new Set object returns only unique values.

Once you have the Set of unique values you can…

# Computer Architecture Basics

Some of the most basic and vital components of what makes a computer work are the processor, memory and I/O devices. Different setups and structures of these components can allow for greater efficiency or specialization for specific tasks.

# Processor

The main component of a computer is the processor. Also referred to as the CPU (central processing unit), the processor is what’s responsible for carrying out the instructions of the computer program. One of the principal circuits of the processor is the APU (arithmetic logic unit) which performs the bitwise and mathematical operations on binary numbers. …

# Fortran : Revolutionary Programming Language

Modern programming languages seem to allow for endless possibilities. Not only can people create web applications in code that resembles the human language but they also have the ability to perform high speed, complex algorithms and data analysis which has become a normal part of our everyday lives. The programming language Fortran (short for FORmula TRANslation) revolutionized the way that humans can interact with computers and use them to assist with the most complex of tasks. Created in 1954 and released in 1957, Fortran is still in use more than 50 years later. … 