https://github.com/datastructures-js/datastructures-js
Data structures in javascript and typescript
https://github.com/datastructures-js/datastructures-js
Last synced: 8 months ago
JSON representation
Data structures in javascript and typescript
- Host: GitHub
- URL: https://github.com/datastructures-js/datastructures-js
- Owner: datastructures-js
- License: mit
- Created: 2015-06-14T11:09:45.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2023-06-20T06:39:07.000Z (over 2 years ago)
- Last Synced: 2025-04-28T10:15:23.889Z (9 months ago)
- Language: JavaScript
- Homepage:
- Size: 376 KB
- Stars: 240
- Watchers: 7
- Forks: 39
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-list - datastructures-js - ranjous | 124 | (JavaScript)
README

[](https://www.npmjs.com/package/datastructures-js)
[](https://www.npmjs.com/package/datastructures-js) [](https://www.npmjs.com/package/datastructures-js)
consolidates all data structures @datastructures-js into a single repository.

## install
```sh
npm install --save datastructures-js
```
### require
```js
const {
Stack,
Queue,
Deque,
EnhancedSet,
LinkedList, LinkedListNode, DoublyLinkedList, DoublyLinkedListNode,
Heap, MinHeap, MaxHeap,
PriorityQueue, MinPriorityQueue, MaxPriorityQueue,
BinarySearchTree, BinarySearchTreeNode, AvlTree, AvlTreeNode,
Trie, TrieNode,
Graph, DirectedGraph,
} = require('datastructures-js');
```
### import
```js
import {
Stack,
Queue,
Deque,
EnhancedSet,
LinkedList, LinkedListNode, DoublyLinkedList, DoublyLinkedListNode,
Heap, MinHeap, MaxHeap,
PriorityQueue, MinPriorityQueue, MaxPriorityQueue,
BinarySearchTree, BinarySearchTreeNode, AvlTree, AvlTreeNode,
Trie, TrieNode,
Graph, DirectedGraph,
} from 'datastructures-js';
```
### extend
Data structures are implemented as ES6 classes (with types definitions) for general purposes. They can be extended for additional functionality and custom requirements.
```js
const { Graph } = require('datastructures-js'); // OR require('@datastructures-js/graph')
class CustomGraph extends Graph {
findShortestPath(pointA, pointB) {
// more code
}
}
```
## Build
```
grunt build
```
## License
The MIT License. Full License is [here](https://github.com/datastructures-js/datastructures-js/blob/master/LICENSE)