UNPKG

3.07 kBMarkdownView Raw
1# ts-ds-tool
2`ts-ds-tool` a tool library of Data Structure and Algorithms based on typescript
3
4[![npm package](https://img.shields.io/npm/v/ts-ds-tool.svg?style=flat-square)](https://www.npmjs.org/package/ts-ds-tool) [![Build Status](https://travis-ci.org/HaifengDu/ts-ds-tool.svg?branch=master)](https://travis-ci.org/HaifengDu/ts_ds_tool) [![codecov](https://codecov.io/gh/HaifengDu/ts-ds-tool/branch/master/graph/badge.svg)](https://codecov.io/gh/HaifengDu/ts_ds_tool)
5
6# Quick Start
7
8## Install
9
10### 1.Use NPM ( Recommend )
11
12``
13npm install ts-ds-tool --save
14``
15
16### 2.Import in Browser
17Use 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.
18
19
20``` html
21<script src="https://unpkg.com/ts-ds-tool/dist/data-structure.min.js"></script>
22
23```
24
25## Included data structures &#128296;
26
27* Linked List &#10004;
28* Double Linked List &#10004;
29* Cycle Linked List &#10004;
30* Queue &#10004;
31* Stack &#10004;
32* Skip List &#10004;
33* Max Heap &#10004;
34* Min Heap &#10004;
35* Priority Queue &#10004;
36* Binomial Heap &#10004;
37* Leftist Tree &#10004;
38* HashTable &#10004;
39* HashMap &#10004;
40* HashSet &#10004;
41* Tree Map &#10004;
42* Tree Set &#10004;
43* Disjoint Set &#10004;
44* Basic Binary Tree &#10004;
45* Binary Search Tree &#10004;
46* AVL Tree &#10004;
47* Red Black Tree &#10004;
48* Fenwick Tree &#10004;
49* Huffman Tree &#10004;
50* Graph &#10004;
51
52## Included algorithms &#128296;
53
54* binary search &#10004;
55* longest common sequence &#10004;
56* kmp &#10004;
57* levenshtein distance &#10004;
58* max sub array &#10004;
59* min and max &#10004;
60* bellman ford &#10004;
61* dijkstra &#10004;
62* floyd warshall &#10004;
63* breadth first search &#10004;
64* depth first search &#10004;
65* isconnected &#10004;
66* isEulerGraph &#10004;
67* getEulerCircuit &#10004;
68* kruskal &#10004;
69* prim &#10004;
70* tarjan &#10004;
71* topo-sort &#10004;
72* tsp branch and bound &#10004;
73* gcd &#10004;
74* lcm &#10004;
75* combination &#10004;
76* combination repeat &#10004;
77* permutation &#10004;
78* power set &#10004;
79* bubble sort &#10004;
80* insert sort &#10004;
81* merge sort &#10004;
82* quick sort repeat &#10004;
83* selection sort &#10004;
84* shell sort &#10004;
85
86## Import
87``` js
88import { Queue } from 'ts-ds-tool';
89import { breadthFirstSearch } from 'ts-ds-tool';
90
91import { sort } from 'ts-ds-tool';
92import { math } from 'ts-ds-tool';
93sort.quickSort([3,2,1]);
94math.gcd(9, 6);
95```
96
97## Run:
98
99```sh
100$ git clone git@github.com:HaifengDu/ts_ds_tool.git
101$ cd ts_ds_tool
102$ npm install
103```
104
105This will setup the library dependencies for you.
106
107To run tests, run
108
109```sh
110$ npm run test
111```
112
113To lint your code, run
114
115```sh
116$ npm run lint
117```
118
119To generate test coverage, run
120
121```sh
122$ npm run ci
123```
124
125To compile typescript, run
126```sh
127$ npm run tsc
128```
129
130To only build, run
131```sh
132$ npm run build:dist
133```
134
135To compile and build, run
136
137```sh
138$ npm run build
139```
140
141## License &#128064;
142
143This project is licensed under the MIT License.
\No newline at end of file