Check if a Binary Tree is Balanced in JavaScript
This article looks at the interview question — Check if a binary tree is balanced.
Every InitJS article tagged algorithms.
21 articles
This article looks at the interview question — Check if a binary tree is balanced.
Discover Quicksort: an efficient sorting algorithm for performance-critical applications. Learn its benefits & implementation in…
We will guide you through the steps to sort by JS, enabling you to take your website to the next level of functionality and usability.
There are several ways to implement a graph in JavaScript, but one common approach is to use an object to represent the graph and an adjacency list to…
A hash table, also known as a hash map, is a data structure that stores key-value pairs in an efficient manner. It uses a hashing function to map keys to…
A tree is a widely used data structure in computer science that consists of a set of nodes organized in a hierarchical manner. Each node in a tree has a parent…
Tries, also known as prefix trees, are a data structure used for storing and searching for strings in an efficient manner. They are commonly used in…
Quick sort is a popular and efficient sorting algorithm that works by dividing and conquering an array of data. It operates by selecting a pivot element from…
Selection sort is a simple sorting algorithm that works by iterating through an array and selecting the minimum element. It then swaps this element with the…
Heap sort is a comparison-based sorting algorithm that uses a binary heap data structure to sort an array in ascending or descending order. It is an in-place…
Bucket sort is a distribution sort. It works by arranging elements into ‘buckets’ which are then sorted using another sort. This typically utilizes insertion…
So where does the name come from? It’s based on the idea that it’s easier to merge two already sorted lists than it is to sort one unsorted list. Therefore,…
Insertion sort works by looking at each element within a list (starting with the second element) and comparing it with the item before. If the item before is…
This is the introduction to a series on sorting algorithms in JavaScript. You might be wondering why should you learn all these algorithms when there’s already…
While we do want to learn the most efficient algorithms, studying the most inefficient algorithms can also give us context about what exactly a good algorithm…
This is the third article in a series about programming interview questions and how to think through and solve them! This article will cover the roman numeral…
This is the third of a series of articles on implementing data structures in JavaScript. If you’re new to data structures, be sure to start from the beginning…
This is the second of a series of articles on implementing data structures in JavaScript. If you’re new to data structures, be sure to read this introduction…
This is the second in a series about programming interview questions and how to think through and solve them! Have you already solved this one? Check out all…
This is the first of a series of articles on implementing data structures in JavaScript. If you’re new to data structures, be sure to read this introduction…
This is the second article in series about programming interview questions and how to think through and solve them! If you want to start from the beginning,…