Hello to all! I recently launched the
JavaScript Algorithms and Data Structures project on GitHub, which contains examples of classical algorithms and data structures written in JavaScript with explanations, examples, and links for further study (in particular, on relevant YouTube videos).
The main objective of the project is to
help programmers learn and use algorithms and do it in JavaScript.
In order to make the learning process more understandable, I tried to add
graphic illustrations for each algorithm and data structure in order to visually understand what was going on and how this or that algorithm functions.
Also in the root README you will find
background information that may be useful when studying. For example:
')
- Charts Big O notation (to visually quickly catch the difference between
O(n!)
And O(n^2)
) - A list with specific values of Big O (to understand how big or small a value is at 10! (And it already has 3628800))
- The difficulty of performing basic operations for data structures (in order to understand which structures have a fast read and which ones have a search or delete)
- Comparative table of the complexity of sorting algorithms (to understand which sorting method to choose and in what case, whether the sorting is stable or not)
All code is 100% covered by unit tests . This is done not only to keep the code in a healthy state, but also to illustrate the methods and uses of this particular algorithm or data structure (what to do, for example, if the graph is directed in one of the algorithms).
The repository also contains a
sandbox . This is a small template of a function and an empty test for it, which should help the programmer to immediately start experimenting with algorithms, instead of re-creating the template code.
At the moment, the following
data structures are implemented in the repository:
- Linked List
- Queue
- Stack
- Hash table
- Heap
- Priority queue
- Trie
- Tree (Binary Search Tree, AVL Tree)
- Graph (both directed and undirected)
- Disjoint set
Additionally
, more than 50 popular algorithms are also
implemented . Among which there are sorting, search algorithms, algorithms associated with graphs, trees, sets, strings and mathematical calculations. Algorithms are divided into the following groups:
- Brute Force Algorithms (enumerating all possible combinations and choosing the right solution)
- Greedy Algorithms (choosing the optimal solution at each current step)
- Divide and Conquer Algorithms (splitting the problem into smaller parts and solving these parts of the problem separately)
- Dynamic Programming Algorithms (building a solution based on previously calculated data in previous steps)
- Backtracking Algorithms (enumeration of all combinations (as in the Brute Force) with constant checking whether the current solution satisfies the restrictions or not; otherwise, go back a step)
The
JavaScript Algorithms and Data Structures repository is under active development. This means that there will be new implementations of algorithms and data structures. However, I hope this repository can be useful right now. Easy coding!