This repository contains implementations of common data structures and algorithms using modern JavaScript.
The intention with this repository is not to only serve as a playground to learn DSA (or as a refresher) but also to practice solving different coding problems using DSA.
- Array
- Linked list
- Doubly-linked list
- Stack
- Queue
- Tree
- Trie
- Binary search tree
- AVL tree
- Red-Black tree
- Binary heap
- Graph
- Bubble sort
- Insertion sort
- Selection sort
- Merge sort
- Quick sort
- Bucket sort
- Counting sort
- Radix sort
- Cycle sort
- Heap sort
- Topological sort (top-sort)
- Linear search
- Binary search
- Interpolation search
- Breadth first search
- Depth first search
Shortest path
- Dijkstra's
- Floyd-Warshall
- Minimum spanning tree (MST)
- Prim's
- Kruskal's
- Bellman–Ford
- Divide and conquer
- Dynamic programming
- Greedy
- Backtracking
There are 2 directories algorithms and data-structures where you can find all the different implementations. Each algorithm and data structure would have a README file containing a small description and a list of coding problems that maps to a *.problems.test.js file containing the solutions.
To run your own copy, fork this repository and execute:
npm i
npm test
You can target specific tests by using the --testNamePattern (or -t) flag. For example,
To run all the tests related to the array data structure, you can execute:
npm test -- -t "Array"
To run tests the array problem 1, you can execute:
npm test -- -t "Array Problem 1"
This project uses Jest for writing the tests and SWC as the test runner.
These are the resources I've been using to sharp my DSA skills in case you are also interested: