ts-ds-tool
Version:
Data structure and algorithm of TypeScript
143 lines (113 loc) • 3.07 kB
Markdown
# ts-ds-tool
`ts-ds-tool` a tool library of Data Structure and Algorithms based on typescript
[](https://www.npmjs.org/package/ts-ds-tool) [](https://travis-ci.org/HaifengDu/ts_ds_tool) [](https://codecov.io/gh/HaifengDu/ts_ds_tool)
# Quick Start
## Install
### 1.Use NPM ( Recommend )
``
npm install ts-ds-tool --save
``
### 2.Import in Browser
Use the script tags in the browser to directly import the file and use the global variable DataStructure. We provide files such as ts-ds-tool/data-structure.min.js in the `ts-ds-tool/dist` directory in the npm package, or via [unpkg](https://unpkg.com/ts-ds-tool/) Download it.
``` html
<script src="https://unpkg.com/ts-ds-tool/dist/data-structure.min.js"></script>
```
## Included data structures 🔨
* Linked List ✔
* Double Linked List ✔
* Cycle Linked List ✔
* Queue ✔
* Stack ✔
* Skip List ✔
* Max Heap ✔
* Min Heap ✔
* Priority Queue ✔
* Binomial Heap ✔
* Leftist Tree ✔
* HashTable ✔
* HashMap ✔
* HashSet ✔
* Tree Map ✔
* Tree Set ✔
* Disjoint Set ✔
* Basic Binary Tree ✔
* Binary Search Tree ✔
* AVL Tree ✔
* Red Black Tree ✔
* Fenwick Tree ✔
* Huffman Tree ✔
* Graph ✔
## Included algorithms 🔨
* binary search ✔
* longest common sequence ✔
* kmp ✔
* levenshtein distance ✔
* max sub array ✔
* min and max ✔
* bellman ford ✔
* dijkstra ✔
* floyd warshall ✔
* breadth first search ✔
* depth first search ✔
* isconnected ✔
* isEulerGraph ✔
* getEulerCircuit ✔
* kruskal ✔
* prim ✔
* tarjan ✔
* topo-sort ✔
* tsp branch and bound ✔
* gcd ✔
* lcm ✔
* combination ✔
* combination repeat ✔
* permutation ✔
* power set ✔
* bubble sort ✔
* insert sort ✔
* merge sort ✔
* quick sort repeat ✔
* selection sort ✔
* shell sort ✔
## Import
``` js
import { Queue } from 'ts-ds-tool';
import { breadthFirstSearch } from 'ts-ds-tool';
import { sort } from 'ts-ds-tool';
import { math } from 'ts-ds-tool';
sort.quickSort([3,2,1]);
math.gcd(9, 6);
```
## Run:
```sh
$ git clone git@github.com:HaifengDu/ts_ds_tool.git
$ cd ts_ds_tool
$ npm install
```
This will setup the library dependencies for you.
To run tests, run
```sh
$ npm run test
```
To lint your code, run
```sh
$ npm run lint
```
To generate test coverage, run
```sh
$ npm run ci
```
To compile typescript, run
```sh
$ npm run tsc
```
To only build, run
```sh
$ npm run build:dist
```
To compile and build, run
```sh
$ npm run build
```
## License 👀
This project is licensed under the MIT License.