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 | ``
|
13 | npm install ts-ds-tool --save
|
14 | ``
|
15 |
|
16 | ### 2.Import in Browser
|
17 | 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.
|
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 🔨
|
26 |
|
27 | * Linked List ✔
|
28 | * Double Linked List ✔
|
29 | * Cycle Linked List ✔
|
30 | * Queue ✔
|
31 | * Stack ✔
|
32 | * Skip List ✔
|
33 | * Max Heap ✔
|
34 | * Min Heap ✔
|
35 | * Priority Queue ✔
|
36 | * Binomial Heap ✔
|
37 | * Leftist Tree ✔
|
38 | * HashTable ✔
|
39 | * HashMap ✔
|
40 | * HashSet ✔
|
41 | * Tree Map ✔
|
42 | * Tree Set ✔
|
43 | * Disjoint Set ✔
|
44 | * Basic Binary Tree ✔
|
45 | * Binary Search Tree ✔
|
46 | * AVL Tree ✔
|
47 | * Red Black Tree ✔
|
48 | * Fenwick Tree ✔
|
49 | * Huffman Tree ✔
|
50 | * Graph ✔
|
51 |
|
52 | ## Included algorithms 🔨
|
53 |
|
54 | * binary search ✔
|
55 | * longest common sequence ✔
|
56 | * kmp ✔
|
57 | * levenshtein distance ✔
|
58 | * max sub array ✔
|
59 | * min and max ✔
|
60 | * bellman ford ✔
|
61 | * dijkstra ✔
|
62 | * floyd warshall ✔
|
63 | * breadth first search ✔
|
64 | * depth first search ✔
|
65 | * isconnected ✔
|
66 | * isEulerGraph ✔
|
67 | * getEulerCircuit ✔
|
68 | * kruskal ✔
|
69 | * prim ✔
|
70 | * tarjan ✔
|
71 | * topo-sort ✔
|
72 | * tsp branch and bound ✔
|
73 | * gcd ✔
|
74 | * lcm ✔
|
75 | * combination ✔
|
76 | * combination repeat ✔
|
77 | * permutation ✔
|
78 | * power set ✔
|
79 | * bubble sort ✔
|
80 | * insert sort ✔
|
81 | * merge sort ✔
|
82 | * quick sort repeat ✔
|
83 | * selection sort ✔
|
84 | * shell sort ✔
|
85 |
|
86 | ## Import
|
87 | ``` js
|
88 | import { Queue } from 'ts-ds-tool';
|
89 | import { breadthFirstSearch } from 'ts-ds-tool';
|
90 |
|
91 | import { sort } from 'ts-ds-tool';
|
92 | import { math } from 'ts-ds-tool';
|
93 | sort.quickSort([3,2,1]);
|
94 | math.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 |
|
105 | This will setup the library dependencies for you.
|
106 |
|
107 | To run tests, run
|
108 |
|
109 | ```sh
|
110 | $ npm run test
|
111 | ```
|
112 |
|
113 | To lint your code, run
|
114 |
|
115 | ```sh
|
116 | $ npm run lint
|
117 | ```
|
118 |
|
119 | To generate test coverage, run
|
120 |
|
121 | ```sh
|
122 | $ npm run ci
|
123 | ```
|
124 |
|
125 | To compile typescript, run
|
126 | ```sh
|
127 | $ npm run tsc
|
128 | ```
|
129 |
|
130 | To only build, run
|
131 | ```sh
|
132 | $ npm run build:dist
|
133 | ```
|
134 |
|
135 | To compile and build, run
|
136 |
|
137 | ```sh
|
138 | $ npm run build
|
139 | ```
|
140 |
|
141 | ## License 👀
|
142 |
|
143 | This project is licensed under the MIT License. |
\ | No newline at end of file |