data-structure-typed 1.42.5 → 1.42.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -1
- package/CONTRIBUTING.md +66 -5
- package/README.md +195 -103
- package/package.json +5 -5
- package/test/performance/reportor.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -8,7 +8,7 @@ All notable changes to this project will be documented in this file.
|
|
|
8
8
|
- [Semantic Versioning](https://semver.org/spec/v2.0.0.html)
|
|
9
9
|
- [`auto-changelog`](https://github.com/CookPete/auto-changelog)
|
|
10
10
|
|
|
11
|
-
## [v1.42.
|
|
11
|
+
## [v1.42.6](https://github.com/zrwusa/data-structure-typed/compare/v1.35.0...main) (upcoming)
|
|
12
12
|
|
|
13
13
|
### Changes
|
|
14
14
|
|
package/CONTRIBUTING.md
CHANGED
|
@@ -3,10 +3,70 @@
|
|
|
3
3
|
**General Rules**
|
|
4
4
|
|
|
5
5
|
- As much as possible, try to follow the existing format of markdown and code.
|
|
6
|
-
- Don't forget to run `npm run lint` and `npm test` before submitting pull requests.
|
|
6
|
+
- Don't forget to run `npm run check`,`npm run lint` and `npm test` before submitting pull requests.
|
|
7
7
|
- Make sure that **100%** of your code is covered by tests.
|
|
8
8
|
|
|
9
|
-
**
|
|
9
|
+
**Conventional Commits**
|
|
10
|
+
<table>
|
|
11
|
+
<tr>
|
|
12
|
+
<th>Identifier</th>
|
|
13
|
+
<th>Purpose</th>
|
|
14
|
+
</tr>
|
|
15
|
+
<tr>
|
|
16
|
+
<td>feat</td>
|
|
17
|
+
<td>Introduce a new feature</td>
|
|
18
|
+
</tr>
|
|
19
|
+
<tr>
|
|
20
|
+
<td>fix</td>
|
|
21
|
+
<td>Fix an error or defect</td>
|
|
22
|
+
</tr>
|
|
23
|
+
<tr>
|
|
24
|
+
<td>chore</td>
|
|
25
|
+
<td>General maintenance tasks (e.g., build, configuration, dependencies)</td>
|
|
26
|
+
</tr>
|
|
27
|
+
<tr>
|
|
28
|
+
<td>docs</td>
|
|
29
|
+
<td>Documentation changes (additions, updates, fixes)</td>
|
|
30
|
+
</tr>
|
|
31
|
+
<tr>
|
|
32
|
+
<td>style</td>
|
|
33
|
+
<td>Changes in code style, formatting, whitespace, etc. (no impact on functionality)</td>
|
|
34
|
+
</tr>
|
|
35
|
+
<tr>
|
|
36
|
+
<td>refactor</td>
|
|
37
|
+
<td>Code refactoring (typically, no functional changes)</td>
|
|
38
|
+
</tr>
|
|
39
|
+
<tr>
|
|
40
|
+
<td>perf</td>
|
|
41
|
+
<td>Performance optimizations</td>
|
|
42
|
+
</tr>
|
|
43
|
+
<tr>
|
|
44
|
+
<td>test</td>
|
|
45
|
+
<td>Changes related to tests (additions, updates, fixes)</td>
|
|
46
|
+
</tr>
|
|
47
|
+
<tr>
|
|
48
|
+
<td>build</td>
|
|
49
|
+
<td>Changes to the build system or external dependencies</td>
|
|
50
|
+
</tr>
|
|
51
|
+
<tr>
|
|
52
|
+
<td>ci</td>
|
|
53
|
+
<td>Changes related to continuous integration and deployment (CI/CD)</td>
|
|
54
|
+
</tr>
|
|
55
|
+
<tr>
|
|
56
|
+
<td>revert</td>
|
|
57
|
+
<td>Revert a previous commit</td>
|
|
58
|
+
</tr>
|
|
59
|
+
<tr>
|
|
60
|
+
<td>merge</td>
|
|
61
|
+
<td>Merge branches or pull requests</td>
|
|
62
|
+
</tr>
|
|
63
|
+
<tr>
|
|
64
|
+
<td>release</td>
|
|
65
|
+
<td>Commits related to version releases</td>
|
|
66
|
+
</tr>
|
|
67
|
+
</table>
|
|
68
|
+
|
|
69
|
+
**Contributing new features**
|
|
10
70
|
|
|
11
71
|
- To ensure that there are no conflicts when merging the branch into the main branch,
|
|
12
72
|
- it is necessary to perform the following steps each time new development is going to be conducted on non-main branches:
|
|
@@ -15,8 +75,9 @@
|
|
|
15
75
|
- resolve conflicts before continuing the development.
|
|
16
76
|
- After new features developed
|
|
17
77
|
- `git add .`
|
|
18
|
-
- `git commit -m
|
|
19
|
-
- `
|
|
78
|
+
- `git commit -m "feat(rbtree): features`
|
|
79
|
+
- `feat(rbtree):` needs to be replaced by the module you have modified
|
|
80
|
+
- `features` must be replaced by the detailed description about the features you implemented
|
|
20
81
|
- `git push`
|
|
21
82
|
- click the `New pull request` on Github https://github.com/zrwusa/data-structure-typed/branches
|
|
22
83
|
|
|
@@ -26,6 +87,6 @@
|
|
|
26
87
|
contributing "several data structures" all at once contribute them all
|
|
27
88
|
one by one separately (i.e. one pull request for "RBTree", another one
|
|
28
89
|
for "AATree" and so on).
|
|
29
|
-
-
|
|
90
|
+
- Modify **README.md** for each of the data structure **with explanations** of
|
|
30
91
|
the algorithm and **with links** to further readings.
|
|
31
92
|
- Describe what you do in code using **comments**.
|
package/README.md
CHANGED
|
@@ -27,8 +27,105 @@ Now you can use this library in Node.js and browser environments in CommonJS(req
|
|
|
27
27
|
|
|
28
28
|
## Built-in classic algorithms
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
<table>
|
|
31
|
+
<thead>
|
|
32
|
+
<tr>
|
|
33
|
+
<th>Algorithm</th>
|
|
34
|
+
<th>Function Description</th>
|
|
35
|
+
<th>Iteration Type</th>
|
|
36
|
+
</tr>
|
|
37
|
+
</thead>
|
|
38
|
+
<tbody>
|
|
39
|
+
<tr>
|
|
40
|
+
<td>Binary Tree DFS</td>
|
|
41
|
+
<td>Traverse a binary tree in a depth-first manner, starting from the root node, first visiting the left subtree,
|
|
42
|
+
and then the right subtree, using recursion.
|
|
43
|
+
</td>
|
|
44
|
+
<td>Recursion + Iteration</td>
|
|
45
|
+
</tr>
|
|
46
|
+
<tr>
|
|
47
|
+
<td>Binary Tree BFS</td>
|
|
48
|
+
<td>Traverse a binary tree in a breadth-first manner, starting from the root node, visiting nodes level by level
|
|
49
|
+
from left to right.
|
|
50
|
+
</td>
|
|
51
|
+
<td>Iteration</td>
|
|
52
|
+
</tr>
|
|
53
|
+
<tr>
|
|
54
|
+
<td>Graph DFS</td>
|
|
55
|
+
<td>Traverse a graph in a depth-first manner, starting from a given node, exploring along one path as deeply as
|
|
56
|
+
possible, and backtracking to explore other paths. Used for finding connected components, paths, etc.
|
|
57
|
+
</td>
|
|
58
|
+
<td>Recursion + Iteration</td>
|
|
59
|
+
</tr>
|
|
60
|
+
<tr>
|
|
61
|
+
<td>Binary Tree Morris</td>
|
|
62
|
+
<td>Morris traversal is an in-order traversal algorithm for binary trees with O(1) space complexity. It allows tree
|
|
63
|
+
traversal without additional stack or recursion.
|
|
64
|
+
</td>
|
|
65
|
+
<td>Iteration</td>
|
|
66
|
+
</tr>
|
|
67
|
+
<tr>
|
|
68
|
+
<td>Graph BFS</td>
|
|
69
|
+
<td>Traverse a graph in a breadth-first manner, starting from a given node, first visiting nodes directly connected
|
|
70
|
+
to the starting node, and then expanding level by level. Used for finding shortest paths, etc.
|
|
71
|
+
</td>
|
|
72
|
+
<td>Recursion + Iteration</td>
|
|
73
|
+
</tr>
|
|
74
|
+
<tr>
|
|
75
|
+
<td>Graph Tarjan's Algorithm</td>
|
|
76
|
+
<td>Find strongly connected components in a graph, typically implemented using depth-first search.</td>
|
|
77
|
+
<td>Recursion</td>
|
|
78
|
+
</tr>
|
|
79
|
+
<tr>
|
|
80
|
+
<td>Graph Bellman-Ford Algorithm</td>
|
|
81
|
+
<td>Finding the shortest paths from a single source, can handle negative weight edges</td>
|
|
82
|
+
<td>Iteration</td>
|
|
83
|
+
</tr>
|
|
84
|
+
<tr>
|
|
85
|
+
<td>Graph Dijkstra's Algorithm</td>
|
|
86
|
+
<td>Finding the shortest paths from a single source, cannot handle negative weight edges</td>
|
|
87
|
+
<td>Iteration</td>
|
|
88
|
+
</tr>
|
|
89
|
+
<tr>
|
|
90
|
+
<td>Graph Floyd-Warshall Algorithm</td>
|
|
91
|
+
<td>Finding the shortest paths between all pairs of nodes</td>
|
|
92
|
+
<td>Iteration</td>
|
|
93
|
+
</tr>
|
|
94
|
+
<tr>
|
|
95
|
+
<td>Graph getCycles</td>
|
|
96
|
+
<td>Find all cycles in a graph or detect the presence of cycles.</td>
|
|
97
|
+
<td>Recursion</td>
|
|
98
|
+
</tr>
|
|
99
|
+
<tr>
|
|
100
|
+
<td>Graph getCutVertexes</td>
|
|
101
|
+
<td>Find cut vertices in a graph, which are nodes that, when removed, increase the number of connected components in
|
|
102
|
+
the graph.
|
|
103
|
+
</td>
|
|
104
|
+
<td>Recursion</td>
|
|
105
|
+
</tr>
|
|
106
|
+
<tr>
|
|
107
|
+
<td>Graph getSCCs</td>
|
|
108
|
+
<td>Find strongly connected components in a graph, which are subgraphs where any two nodes can reach each other.
|
|
109
|
+
</td>
|
|
110
|
+
<td>Recursion</td>
|
|
111
|
+
</tr>
|
|
112
|
+
<tr>
|
|
113
|
+
<td>Graph getBridges</td>
|
|
114
|
+
<td>Find bridges in a graph, which are edges that, when removed, increase the number of connected components in the
|
|
115
|
+
graph.
|
|
116
|
+
</td>
|
|
117
|
+
<td>Recursion</td>
|
|
118
|
+
</tr>
|
|
119
|
+
<tr>
|
|
120
|
+
<td>Graph topologicalSort</td>
|
|
121
|
+
<td>Perform topological sorting on a directed acyclic graph (DAG) to find a linear order of nodes such that all
|
|
122
|
+
directed edges go from earlier nodes to later nodes.
|
|
123
|
+
</td>
|
|
124
|
+
<td>Recursion</td>
|
|
125
|
+
</tr>
|
|
126
|
+
</tbody>
|
|
127
|
+
</table>
|
|
128
|
+
|
|
32
129
|
|
|
33
130
|
## Installation and Usage
|
|
34
131
|
|
|
@@ -54,11 +151,12 @@ import {
|
|
|
54
151
|
|
|
55
152
|
### CDN
|
|
56
153
|
|
|
154
|
+
Copy the line below into the head tag in an HTML document.
|
|
57
155
|
```html
|
|
58
|
-
|
|
59
156
|
<script src='https://cdn.jsdelivr.net/npm/data-structure-typed/dist/umd/data-structure-typed.min.js'></script>
|
|
60
157
|
```
|
|
61
158
|
|
|
159
|
+
Copy the code below into the script tag of your HTML, and you're good to go with your development work.
|
|
62
160
|
```js
|
|
63
161
|
const {Heap} = dataStructureTyped;
|
|
64
162
|
const {
|
|
@@ -84,7 +182,7 @@ const {
|
|
|
84
182
|
|
|
85
183
|
<a href="https://github.com/zrwusa/vivid-algorithm" target="_blank">Examples Repository</a>
|
|
86
184
|
|
|
87
|
-
## Code
|
|
185
|
+
## Code Snippets
|
|
88
186
|
|
|
89
187
|
### Binary Search Tree (BST) snippet
|
|
90
188
|
|
|
@@ -99,27 +197,40 @@ bst.add(3);
|
|
|
99
197
|
bst.addMany([15, 1, 8, 13, 16, 2, 6, 9, 12, 14, 4, 7, 10, 5]);
|
|
100
198
|
bst.size === 16; // true
|
|
101
199
|
bst.has(6); // true
|
|
102
|
-
const node6 = bst.
|
|
200
|
+
const node6 = bst.getNode(6); // BSTNode
|
|
103
201
|
bst.getHeight(6) === 2; // true
|
|
104
202
|
bst.getHeight() === 5; // true
|
|
105
203
|
bst.getDepth(6) === 3; // true
|
|
106
204
|
|
|
107
|
-
bst.getLeftMost()?.
|
|
205
|
+
bst.getLeftMost()?.key === 1; // true
|
|
108
206
|
|
|
109
207
|
bst.delete(6);
|
|
110
|
-
bst.get(6); //
|
|
208
|
+
bst.get(6); // undefined
|
|
111
209
|
bst.isAVLBalanced(); // true
|
|
112
210
|
bst.bfs()[0] === 11; // true
|
|
113
211
|
|
|
114
|
-
const objBST = new BST<
|
|
115
|
-
|
|
116
|
-
objBST.add(
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
212
|
+
const objBST = new BST<{height: number, age: number}>();
|
|
213
|
+
|
|
214
|
+
objBST.add(11, { "name": "Pablo", "age": 15 });
|
|
215
|
+
objBST.add(3, { "name": "Kirk", "age": 1 });
|
|
216
|
+
|
|
217
|
+
objBST.addMany([15, 1, 8, 13, 16, 2, 6, 9, 12, 14, 4, 7, 10, 5], [
|
|
218
|
+
{ "name": "Alice", "age": 15 },
|
|
219
|
+
{ "name": "Bob", "age": 1 },
|
|
220
|
+
{ "name": "Charlie", "age": 8 },
|
|
221
|
+
{ "name": "David", "age": 13 },
|
|
222
|
+
{ "name": "Emma", "age": 16 },
|
|
223
|
+
{ "name": "Frank", "age": 2 },
|
|
224
|
+
{ "name": "Grace", "age": 6 },
|
|
225
|
+
{ "name": "Hannah", "age": 9 },
|
|
226
|
+
{ "name": "Isaac", "age": 12 },
|
|
227
|
+
{ "name": "Jack", "age": 14 },
|
|
228
|
+
{ "name": "Katie", "age": 4 },
|
|
229
|
+
{ "name": "Liam", "age": 7 },
|
|
230
|
+
{ "name": "Mia", "age": 10 },
|
|
231
|
+
{ "name": "Noah", "age": 5 }
|
|
232
|
+
]
|
|
233
|
+
);
|
|
123
234
|
|
|
124
235
|
objBST.delete(11);
|
|
125
236
|
```
|
|
@@ -133,39 +244,21 @@ const bst = new BST();
|
|
|
133
244
|
bst.add(11);
|
|
134
245
|
bst.add(3);
|
|
135
246
|
bst.addMany([15, 1, 8, 13, 16, 2, 6, 9, 12, 14, 4, 7, 10, 5]);
|
|
136
|
-
bst.size === 16;
|
|
137
|
-
bst.has(6);
|
|
138
|
-
const node6 = bst.
|
|
139
|
-
bst.getHeight(6) === 2;
|
|
140
|
-
bst.getHeight() === 5;
|
|
141
|
-
bst.getDepth(6) === 3;
|
|
247
|
+
bst.size === 16; // true
|
|
248
|
+
bst.has(6); // true
|
|
249
|
+
const node6 = bst.getNode(6);
|
|
250
|
+
bst.getHeight(6) === 2; // true
|
|
251
|
+
bst.getHeight() === 5; // true
|
|
252
|
+
bst.getDepth(6) === 3; // true
|
|
142
253
|
const leftMost = bst.getLeftMost();
|
|
143
|
-
leftMost?.
|
|
144
|
-
|
|
254
|
+
leftMost?.key === 1; // true
|
|
255
|
+
|
|
145
256
|
bst.delete(6);
|
|
146
|
-
bst.get(6);
|
|
147
|
-
bst.isAVLBalanced();
|
|
257
|
+
bst.get(6); // undefined
|
|
258
|
+
bst.isAVLBalanced(); // true or false
|
|
148
259
|
const bfsIDs = bst.bfs();
|
|
149
|
-
bfsIDs[0] === 11;
|
|
150
|
-
expect(bfsIDs[0]).toBe(11);
|
|
260
|
+
bfsIDs[0] === 11; // true
|
|
151
261
|
|
|
152
|
-
const objBST = new BST();
|
|
153
|
-
objBST.add(11, {id: 11, keyA: 11});
|
|
154
|
-
objBST.add(3, {id: 3, keyA: 3});
|
|
155
|
-
|
|
156
|
-
objBST.addMany([{id: 15, keyA: 15}, {id: 1, keyA: 1}, {id: 8, keyA: 8},
|
|
157
|
-
{id: 13, keyA: 13}, {id: 16, keyA: 16}, {id: 2, keyA: 2},
|
|
158
|
-
{id: 6, keyA: 6}, {id: 9, keyA: 9}, {id: 12, keyA: 12},
|
|
159
|
-
{id: 14, keyA: 14}, {id: 4, keyA: 4}, {id: 7, keyA: 7},
|
|
160
|
-
{id: 10, keyA: 10}, {id: 5, keyA: 5}]);
|
|
161
|
-
|
|
162
|
-
objBST.delete(11);
|
|
163
|
-
|
|
164
|
-
const avlTree = new AVLTree();
|
|
165
|
-
avlTree.addMany([11, 3, 15, 1, 8, 13, 16, 2, 6, 9, 12, 14, 4, 7, 10, 5])
|
|
166
|
-
avlTree.isAVLBalanced(); // true
|
|
167
|
-
avlTree.delete(10);
|
|
168
|
-
avlTree.isAVLBalanced(); // true
|
|
169
262
|
```
|
|
170
263
|
|
|
171
264
|
### AVLTree snippet
|
|
@@ -222,7 +315,7 @@ graph.addVertex('C');
|
|
|
222
315
|
graph.addEdge('A', 'B');
|
|
223
316
|
graph.addEdge('B', 'C');
|
|
224
317
|
|
|
225
|
-
const
|
|
318
|
+
const topologicalOrderKeys = graph.topologicalSort(); // ['A', 'B', 'C']
|
|
226
319
|
```
|
|
227
320
|
|
|
228
321
|
### Undirected Graph snippet
|
|
@@ -242,7 +335,7 @@ graph.addEdge('A', 'B');
|
|
|
242
335
|
graph.addEdge('B', 'D');
|
|
243
336
|
|
|
244
337
|
const dijkstraResult = graph.dijkstra('A');
|
|
245
|
-
Array.from(dijkstraResult?.seen ?? []).map(vertex => vertex.
|
|
338
|
+
Array.from(dijkstraResult?.seen ?? []).map(vertex => vertex.key) // ['A', 'B', 'D']
|
|
246
339
|
```
|
|
247
340
|
|
|
248
341
|
## Data Structures
|
|
@@ -444,12 +537,6 @@ Array.from(dijkstraResult?.seen ?? []).map(vertex => vertex.id) // ['A', 'B', 'D
|
|
|
444
537
|
</tr>
|
|
445
538
|
</thead>
|
|
446
539
|
<tbody>
|
|
447
|
-
<tr>
|
|
448
|
-
<td>Array<E></td>
|
|
449
|
-
<td>vector<T></td>
|
|
450
|
-
<td>ArrayList<E></td>
|
|
451
|
-
<td>list</td>
|
|
452
|
-
</tr>
|
|
453
540
|
<tr>
|
|
454
541
|
<td>DoublyLinkedList<E></td>
|
|
455
542
|
<td>list<T></td>
|
|
@@ -463,30 +550,23 @@ Array.from(dijkstraResult?.seen ?? []).map(vertex => vertex.id) // ['A', 'B', 'D
|
|
|
463
550
|
<td>-</td>
|
|
464
551
|
</tr>
|
|
465
552
|
<tr>
|
|
466
|
-
<td>
|
|
467
|
-
<td>
|
|
468
|
-
<td>
|
|
469
|
-
<td>
|
|
470
|
-
</tr>
|
|
471
|
-
<tr>
|
|
472
|
-
<td>Map<K, V></td>
|
|
473
|
-
<td>map<K, V></td>
|
|
474
|
-
<td>HashMap<K, V></td>
|
|
475
|
-
<td>dict</td>
|
|
476
|
-
</tr>
|
|
477
|
-
<tr>
|
|
478
|
-
<td>Map<K, V></td>
|
|
479
|
-
<td>-</td>
|
|
480
|
-
<td>-</td>
|
|
481
|
-
<td>OrderedDict</td>
|
|
553
|
+
<td>Array<E></td>
|
|
554
|
+
<td>vector<T></td>
|
|
555
|
+
<td>ArrayList<E></td>
|
|
556
|
+
<td>list</td>
|
|
482
557
|
</tr>
|
|
483
|
-
|
|
484
558
|
<tr>
|
|
485
559
|
<td>Queue<E></td>
|
|
486
560
|
<td>queue<T></td>
|
|
487
561
|
<td>Queue<E></td>
|
|
488
562
|
<td>-</td>
|
|
489
563
|
</tr>
|
|
564
|
+
<tr>
|
|
565
|
+
<td>Deque<E></td>
|
|
566
|
+
<td>deque<T></td>
|
|
567
|
+
<td>-</td>
|
|
568
|
+
<td>-</td>
|
|
569
|
+
</tr>
|
|
490
570
|
<tr>
|
|
491
571
|
<td>PriorityQueue<E></td>
|
|
492
572
|
<td>priority_queue<T></td>
|
|
@@ -494,7 +574,7 @@ Array.from(dijkstraResult?.seen ?? []).map(vertex => vertex.id) // ['A', 'B', 'D
|
|
|
494
574
|
<td>-</td>
|
|
495
575
|
</tr>
|
|
496
576
|
<tr>
|
|
497
|
-
<td>Heap<
|
|
577
|
+
<td>Heap<E></td>
|
|
498
578
|
<td>priority_queue<T></td>
|
|
499
579
|
<td>PriorityQueue<E></td>
|
|
500
580
|
<td>heapq</td>
|
|
@@ -506,15 +586,21 @@ Array.from(dijkstraResult?.seen ?? []).map(vertex => vertex.id) // ['A', 'B', 'D
|
|
|
506
586
|
<td>-</td>
|
|
507
587
|
</tr>
|
|
508
588
|
<tr>
|
|
509
|
-
<td>
|
|
510
|
-
<td>
|
|
511
|
-
<td
|
|
512
|
-
<td
|
|
589
|
+
<td>Set<E></td>
|
|
590
|
+
<td>set<T></td>
|
|
591
|
+
<td>HashSet<E></td>
|
|
592
|
+
<td>set</td>
|
|
593
|
+
</tr>
|
|
594
|
+
<tr>
|
|
595
|
+
<td>Map<K, V></td>
|
|
596
|
+
<td>map<K, V></td>
|
|
597
|
+
<td>HashMap<K, V></td>
|
|
598
|
+
<td>dict</td>
|
|
513
599
|
</tr>
|
|
514
600
|
<tr>
|
|
515
|
-
<td>Trie</td>
|
|
516
|
-
<td>-</td>
|
|
517
601
|
<td>-</td>
|
|
602
|
+
<td>unordered_set<T></td>
|
|
603
|
+
<td>HashSet<E></td>
|
|
518
604
|
<td>-</td>
|
|
519
605
|
</tr>
|
|
520
606
|
<tr>
|
|
@@ -524,93 +610,99 @@ Array.from(dijkstraResult?.seen ?? []).map(vertex => vertex.id) // ['A', 'B', 'D
|
|
|
524
610
|
<td>defaultdict</td>
|
|
525
611
|
</tr>
|
|
526
612
|
<tr>
|
|
527
|
-
<td
|
|
528
|
-
<td>multiset<T></td>
|
|
613
|
+
<td>Map<K, V></td>
|
|
529
614
|
<td>-</td>
|
|
530
615
|
<td>-</td>
|
|
616
|
+
<td>OrderedDict</td>
|
|
531
617
|
</tr>
|
|
532
618
|
<tr>
|
|
619
|
+
<td>BinaryTree<K, V></td>
|
|
533
620
|
<td>-</td>
|
|
534
|
-
<td>multimap<K, V></td>
|
|
535
621
|
<td>-</td>
|
|
536
622
|
<td>-</td>
|
|
537
623
|
</tr>
|
|
538
624
|
<tr>
|
|
539
|
-
<td>
|
|
625
|
+
<td>BST<K, V></td>
|
|
540
626
|
<td>-</td>
|
|
541
627
|
<td>-</td>
|
|
542
628
|
<td>-</td>
|
|
543
629
|
</tr>
|
|
544
630
|
<tr>
|
|
545
|
-
<td>
|
|
546
|
-
<td
|
|
631
|
+
<td>TreeMultimap<K, V></td>
|
|
632
|
+
<td>multimap<K, V></td>
|
|
547
633
|
<td>-</td>
|
|
548
634
|
<td>-</td>
|
|
549
635
|
</tr>
|
|
550
636
|
<tr>
|
|
551
|
-
<td>
|
|
552
|
-
<td>-</td>
|
|
637
|
+
<td>AVLTree<E></td>
|
|
553
638
|
<td>-</td>
|
|
639
|
+
<td>TreeSet<E></td>
|
|
554
640
|
<td>-</td>
|
|
555
641
|
</tr>
|
|
556
642
|
<tr>
|
|
557
|
-
<td>
|
|
643
|
+
<td>AVLTree<K, V></td>
|
|
558
644
|
<td>-</td>
|
|
645
|
+
<td>TreeMap<K, V></td>
|
|
559
646
|
<td>-</td>
|
|
647
|
+
</tr>
|
|
648
|
+
<tr>
|
|
649
|
+
<td>AVLTree<E></td>
|
|
650
|
+
<td>set</td>
|
|
651
|
+
<td>TreeSet<E></td>
|
|
560
652
|
<td>-</td>
|
|
561
653
|
</tr>
|
|
562
654
|
<tr>
|
|
655
|
+
<td>Trie</td>
|
|
656
|
+
<td>-</td>
|
|
563
657
|
<td>-</td>
|
|
564
|
-
<td>unordered_multiset</td>
|
|
565
658
|
<td>-</td>
|
|
566
|
-
<td>Counter</td>
|
|
567
659
|
</tr>
|
|
568
660
|
<tr>
|
|
569
661
|
<td>-</td>
|
|
662
|
+
<td>multiset<T></td>
|
|
570
663
|
<td>-</td>
|
|
571
|
-
<td>LinkedHashSet<E></td>
|
|
572
664
|
<td>-</td>
|
|
573
665
|
</tr>
|
|
574
666
|
<tr>
|
|
667
|
+
<td>DirectedGraph<V, E></td>
|
|
575
668
|
<td>-</td>
|
|
576
669
|
<td>-</td>
|
|
577
|
-
<td>LinkedHashMap<K, V></td>
|
|
578
670
|
<td>-</td>
|
|
579
671
|
</tr>
|
|
580
672
|
<tr>
|
|
581
|
-
<td>
|
|
673
|
+
<td>UndirectedGraph<V, E></td>
|
|
674
|
+
<td>-</td>
|
|
582
675
|
<td>-</td>
|
|
583
|
-
<td>TreeSet<E></td>
|
|
584
676
|
<td>-</td>
|
|
585
677
|
</tr>
|
|
586
678
|
<tr>
|
|
587
|
-
<td>AVLTree<K, V></td>
|
|
588
679
|
<td>-</td>
|
|
589
|
-
<td>
|
|
680
|
+
<td>unordered_multiset</td>
|
|
590
681
|
<td>-</td>
|
|
682
|
+
<td>Counter</td>
|
|
591
683
|
</tr>
|
|
592
684
|
<tr>
|
|
593
|
-
<td
|
|
594
|
-
<td
|
|
595
|
-
<td>
|
|
685
|
+
<td>-</td>
|
|
686
|
+
<td>-</td>
|
|
687
|
+
<td>LinkedHashSet<E></td>
|
|
596
688
|
<td>-</td>
|
|
597
689
|
</tr>
|
|
598
690
|
<tr>
|
|
599
691
|
<td>-</td>
|
|
600
|
-
<td>unordered_multimap<K, V></td>
|
|
601
692
|
<td>-</td>
|
|
693
|
+
<td>LinkedHashMap<K, V></td>
|
|
602
694
|
<td>-</td>
|
|
603
695
|
</tr>
|
|
604
696
|
<tr>
|
|
605
697
|
<td>-</td>
|
|
606
|
-
<td>
|
|
698
|
+
<td>unordered_multimap<K, V></td>
|
|
607
699
|
<td>-</td>
|
|
608
700
|
<td>-</td>
|
|
609
701
|
</tr>
|
|
610
702
|
<tr>
|
|
611
703
|
<td>-</td>
|
|
612
|
-
<td>
|
|
613
|
-
<td
|
|
704
|
+
<td>bitset<N></td>
|
|
705
|
+
<td>-</td>
|
|
614
706
|
<td>-</td>
|
|
615
707
|
</tr>
|
|
616
708
|
</tbody>
|
|
@@ -633,7 +725,7 @@ optimal approach to data structure design.
|
|
|
633
725
|
|
|
634
726
|
## Benchmark
|
|
635
727
|
|
|
636
|
-
[//]: # (Start of Replace Section)
|
|
728
|
+
[//]: # (No deletion!!! Start of Replace Section)
|
|
637
729
|
<div class="json-to-html-collapse clearfix 0">
|
|
638
730
|
<div class='collapsible level0' ><span class='json-to-html-label'>avl-tree</span></div>
|
|
639
731
|
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>10,000 add randomly</td><td>30.52</td><td>32.76</td><td>3.28e-4</td></tr><tr><td>10,000 add & delete randomly</td><td>66.96</td><td>14.94</td><td>0.00</td></tr><tr><td>10,000 addMany</td><td>39.78</td><td>25.14</td><td>3.67e-4</td></tr><tr><td>10,000 get</td><td>27.38</td><td>36.52</td><td>0.00</td></tr></table></div>
|
|
@@ -672,4 +764,4 @@ optimal approach to data structure design.
|
|
|
672
764
|
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>100,000 push</td><td>59.40</td><td>16.83</td><td>0.01</td></tr><tr><td>100,000 getWords</td><td>90.07</td><td>11.10</td><td>0.00</td></tr></table></div>
|
|
673
765
|
</div>
|
|
674
766
|
|
|
675
|
-
[//]: # (End of Replace Section)
|
|
767
|
+
[//]: # (No deletion!!! End of Replace Section)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "data-structure-typed",
|
|
3
|
-
"version": "1.42.
|
|
3
|
+
"version": "1.42.6",
|
|
4
4
|
"description": "Data Structures of Javascript & TypeScript. Binary Tree, BST, Graph, Heap, Priority Queue, Linked List, Queue, Deque, Stack, AVL Tree, Tree Multiset, Trie, Directed Graph, Undirected Graph, Singly Linked List, Doubly Linked List, Max Heap, Max Priority Queue, Min Heap, Min Priority Queue.",
|
|
5
5
|
"main": "dist/cjs/src/index.js",
|
|
6
6
|
"module": "dist/mjs/src/index.js",
|
|
@@ -64,10 +64,10 @@
|
|
|
64
64
|
"@typescript-eslint/eslint-plugin": "^6.7.4",
|
|
65
65
|
"@typescript-eslint/parser": "^6.7.4",
|
|
66
66
|
"auto-changelog": "^2.4.0",
|
|
67
|
-
"avl-tree-typed": "^1.
|
|
67
|
+
"avl-tree-typed": "^1.42.5",
|
|
68
68
|
"benchmark": "^2.1.4",
|
|
69
|
-
"binary-tree-typed": "^1.
|
|
70
|
-
"bst-typed": "^1.
|
|
69
|
+
"binary-tree-typed": "^1.42.5",
|
|
70
|
+
"bst-typed": "^1.42.5",
|
|
71
71
|
"dependency-cruiser": "^14.1.0",
|
|
72
72
|
"eslint": "^8.50.0",
|
|
73
73
|
"eslint-config-prettier": "^9.0.0",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"eslint-import-resolver-typescript": "^3.6.1",
|
|
76
76
|
"eslint-plugin-import": "^2.28.1",
|
|
77
77
|
"fast-glob": "^3.3.1",
|
|
78
|
-
"heap-typed": "^1.
|
|
78
|
+
"heap-typed": "^1.42.5",
|
|
79
79
|
"istanbul-badges-readme": "^1.8.5",
|
|
80
80
|
"jest": "^29.7.0",
|
|
81
81
|
"prettier": "^3.0.3",
|
|
@@ -100,8 +100,8 @@ const composeReport = () => {
|
|
|
100
100
|
</body>
|
|
101
101
|
</html>`;
|
|
102
102
|
replaceMarkdownContent(
|
|
103
|
-
'[//]: # (Start of Replace Section)', // Start tag
|
|
104
|
-
'[//]: # (End of Replace Section)', // end identifier
|
|
103
|
+
'[//]: # (No deletion!!! Start of Replace Section)', // Start tag
|
|
104
|
+
'[//]: # (No deletion!!! End of Replace Section)', // end identifier
|
|
105
105
|
htmlTables // New content to be inserted
|
|
106
106
|
);
|
|
107
107
|
fs.writeFileSync(htmlFilePath, html);
|