https://github.com/dfernandeza/data-structures-and-algorithms
Implementations for common data structures and algorithms using modern JavaScript.
https://github.com/dfernandeza/data-structures-and-algorithms
algorithms data-structures javascript typescript
Last synced: about 2 months ago
JSON representation
Implementations for common data structures and algorithms using modern JavaScript.
- Host: GitHub
- URL: https://github.com/dfernandeza/data-structures-and-algorithms
- Owner: dfernandeza
- License: mit
- Created: 2022-03-13T13:46:53.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2024-01-07T20:02:28.000Z (about 2 years ago)
- Last Synced: 2024-01-07T21:25:32.557Z (about 2 years ago)
- Topics: algorithms, data-structures, javascript, typescript
- Language: TypeScript
- Homepage:
- Size: 267 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Data structures and algorithms (DSA)


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.
## Covered data structures
- [x] Array
- [x] Linked list
- [x] Doubly-linked list
- [x] Stack
- [x] Queue
- [x] Tree
- [ ] Trie
- [x] Binary search tree
- [x] AVL tree
- [ ] Red-Black tree
- [x] Binary heap
- [x] Graph
## Covered algorithms
### Sorting
- [x] Bubble sort
- [x] Insertion sort
- [x] Selection sort
- [x] Merge sort
- [x] Quick sort
- [x] Bucket sort
- [x] Counting sort
- [x] Radix sort
- [x] Cycle sort
- [x] Heap sort
- [x] Topological sort (top-sort)
### Searching
- [x] Linear search
- [x] Binary search
- [ ] Interpolation search
- [x] Breadth first search
- [x] Depth first search
### Others
Shortest path
- [x] Dijkstra's
- [ ] Floyd-Warshall
- [ ] Minimum spanning tree (MST)
- [ ] Prim's
- [ ] Kruskal's
- [ ] Bellman–Ford
## Covered algorithms designs and techniques
- [x] Divide and conquer
- [x] Dynamic programming
- [x] Greedy
- [x] Backtracking
## Exploring the code
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.
## Running your own copy
To run your own copy, fork this repository and execute:
```
npm i
npm test
```
## Running specific tests
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](https://github.com/facebook/jest) for writing the tests and [SWC](https://github.com/swc-project/swc) as the test runner._
## Resources
These are the resources I've been using to sharp my DSA skills in case you are also interested:
- [Learning JavaScript data structures and algorithms [Book]](https://github.com/PacktPublishing/Learning-JavaScript-Data-Structures-and-Algorithms-Third-Edition)
- [Grokking Algorithms [Book]](https://www.manning.com/books/grokking-algorithms)
- [itsy-bitsy-data-structures](https://github.com/jamiebuilds/itsy-bitsy-data-structures/)
- [GeeksforGeeks](https://www.geeksforgeeks.org/data-structures/)