Native JavaScript Data Structures
JavaScript provides a handful of native data structures that you can start using in your code right now.
The JavaScript data structures collection includes implementations and examples of some of the most commonly-used data structures. Code presented in these articls is best used as a learning resource, as it might require optimizations to run in production.
JavaScript provides a handful of native data structures that you can start using in your code right now.
A queue is a linear data structure which follows a first in, first out (FIFO) order of operations.
A stack is a linear data structure which follows a last in, first out (LIFO) order of operations.
A linked list is a linear data structure where each element points to the next.
A doubly linked list is a linear data structure where each element points both to the next and the previous one.
A graph is a data structure consisting of a set of vertices connected by a set of edges.
A tree is a data structure consisting of a set of linked nodes representing a hierarchical tree structure.
A binary tree is a hierarchical data structure of linked nodes with at most two children each.
A binary search tree is a hierarchical data structure of ordered nodes with at most two children each.
Learn how to build an undirected tree from an array of edges in JavaScript, with various approaches for storing node relationships.
Learn how to traverse an undirected tree using Depth-First Search (DFS) or Breadth-First Search (BFS) in JavaScript.
Learn how to apply bipartite coloring to an undirected tree in JavaScript, ensuring that no two adjacent nodes share the same color.
Using a two-pass DFS approach, we can efficiently find the diameter of an undirected tree in JavaScript.
Using the degree of nodes, we can employ a very efficient algorithmic trick to find the minimum height tree in an undirected tree in JavaScript.
A deep dive into modeling money, currencies, and exchange rates using JavaScript.
After working with 2D arrays for a while, I decided to create a convenient wrapper for operations. Here's the gist of it.
Learn everything you need to know about Big-O notation with this handy cheatsheet.