An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

          

[![npm](https://img.shields.io/npm/v/datastructures-js.svg)](https://www.npmjs.com/package/datastructures-js)
[![npm](https://img.shields.io/npm/dm/datastructures-js.svg)](https://www.npmjs.com/package/datastructures-js) [![npm](https://img.shields.io/badge/node-%3E=%206.0-blue.svg)](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)