Typed data structures, algorithms, and utility functions library for JavaScript/TypeScript
npm install tsalgo!npm bundle size
[![Stargazers][stars-shield]][stars-url]
[![Issues][issues-shield]][issues-url]
!npm
!GitHub Workflow Status
[![MIT License][license-shield]][license-url]
Typed data structures, algorithms, and utility functions library for JavaScript/TypeScript
Explore the docs »
NPM »
Report Bug
·
Request Feature
- Install with npm
``sh`
npm install tsalgo
`
- or yarn
sh`
yarn add tsalgo
`typescript`
import { LinkedList } from 'tsalgo';
or import all
`typescript`
import * as Collections from 'tsalgo';
All implementations use TypeScript generics.
Use with TypeScript instead of JavaScript to get complete Intellisense + type-safety.
`typescript
import { LinkedList } from 'tsalgo';
const ll = new LinkedList
ll.push(100); // push adds to the end of the list
ll.push(200);
ll.push(300);
// Current state = 100 -> 200 -> 300
console.log(ll.shift()); // prints 100
console.log(ll.pop()); // prints 300
console.log(ll.size); // prints 1
console.log(ll.pop()); // prints 200
console.log(ll.size); // prints 0
`
- LinkedList
- DoublyLinkedList (default)
- SinglyLinkedList
- Stack
- Queue
- Heap
- MinHeap (default)
- MaxHeap
- Priority Queue (Heap based)
This is a fairly new library, but I'm adding stuff everyday. See the open issues for a list of proposed features (and known issues).
1. Fork the Project
2. Create your Feature Branch ( git checkout -b feature/something)yarn commit
3. Commit your changes with commitizen (to follow semantic versioning) ( or npm run commit)git push origin feature/something
4. Push to the Branch ()
5. Open a Pull Request
Distributed under the MIT License. See LICENSE` for more information.
[contributors-shield]: https://img.shields.io/github/contributors/amaan18/tsalgo.svg?style=for-the-badge
[forks-shield]: https://img.shields.io/github/forks/othneildrew/tsalgo.svg?style=for-the-badge
[forks-url]: https://github.com/amaan18/tsalgo/network/members
[stars-shield]: https://img.shields.io/github/stars/amaan18/tsalgo.svg?style=for-the-badge
[stars-url]: https://github.com/amaan18/tsalgo/stargazers
[issues-shield]: https://img.shields.io/github/issues/amaan18/tsalgo.svg?style=for-the-badge
[issues-url]: https://github.com/amaan18/tsalgo/issues
[license-shield]: https://img.shields.io/github/license/amaan18/tsalgo.svg?color=red&style=for-the-badge
[license-url]: https://github.com/amaan18/tsalgo/blob/release/LICENSE
[linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=for-the-badge&logo=linkedin&colorB=555