data-structure-typed 1.49.1 → 1.49.3
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/README.md +16 -16
- package/README_zh-CN.md +2 -2
- package/benchmark/report.html +46 -1
- package/benchmark/report.json +457 -22
- package/dist/cjs/data-structures/base/iterable-base.d.ts +11 -0
- package/dist/cjs/data-structures/base/iterable-base.js +21 -0
- package/dist/cjs/data-structures/base/iterable-base.js.map +1 -1
- package/dist/cjs/data-structures/graph/abstract-graph.d.ts +7 -7
- package/dist/cjs/data-structures/graph/abstract-graph.js +43 -12
- package/dist/cjs/data-structures/graph/abstract-graph.js.map +1 -1
- package/dist/cjs/data-structures/graph/directed-graph.d.ts +2 -2
- package/dist/cjs/data-structures/graph/directed-graph.js +2 -2
- package/dist/cjs/data-structures/graph/directed-graph.js.map +1 -1
- package/dist/cjs/data-structures/graph/undirected-graph.d.ts +1 -1
- package/dist/cjs/data-structures/graph/undirected-graph.js +1 -1
- package/dist/cjs/data-structures/graph/undirected-graph.js.map +1 -1
- package/dist/cjs/data-structures/hash/hash-map.d.ts +9 -9
- package/dist/cjs/data-structures/hash/hash-map.js +16 -15
- package/dist/cjs/data-structures/hash/hash-map.js.map +1 -1
- package/dist/cjs/data-structures/heap/heap.d.ts +6 -35
- package/dist/cjs/data-structures/heap/heap.js +10 -42
- package/dist/cjs/data-structures/heap/heap.js.map +1 -1
- package/dist/cjs/data-structures/linked-list/doubly-linked-list.d.ts +99 -105
- package/dist/cjs/data-structures/linked-list/doubly-linked-list.js +143 -146
- package/dist/cjs/data-structures/linked-list/doubly-linked-list.js.map +1 -1
- package/dist/cjs/data-structures/linked-list/singly-linked-list.d.ts +16 -21
- package/dist/cjs/data-structures/linked-list/singly-linked-list.js +42 -42
- package/dist/cjs/data-structures/linked-list/singly-linked-list.js.map +1 -1
- package/dist/cjs/data-structures/linked-list/skip-linked-list.d.ts +25 -25
- package/dist/cjs/data-structures/linked-list/skip-linked-list.js +36 -36
- package/dist/cjs/data-structures/linked-list/skip-linked-list.js.map +1 -1
- package/dist/cjs/data-structures/queue/deque.d.ts +70 -75
- package/dist/cjs/data-structures/queue/deque.js +100 -110
- package/dist/cjs/data-structures/queue/deque.js.map +1 -1
- package/dist/cjs/data-structures/queue/queue.d.ts +37 -38
- package/dist/cjs/data-structures/queue/queue.js +46 -49
- package/dist/cjs/data-structures/queue/queue.js.map +1 -1
- package/dist/cjs/data-structures/stack/stack.d.ts +2 -3
- package/dist/cjs/data-structures/stack/stack.js +2 -5
- package/dist/cjs/data-structures/stack/stack.js.map +1 -1
- package/dist/cjs/data-structures/trie/trie.d.ts +1 -2
- package/dist/cjs/data-structures/trie/trie.js +2 -5
- package/dist/cjs/data-structures/trie/trie.js.map +1 -1
- package/dist/mjs/data-structures/base/iterable-base.d.ts +11 -0
- package/dist/mjs/data-structures/base/iterable-base.js +21 -0
- package/dist/mjs/data-structures/graph/abstract-graph.d.ts +7 -7
- package/dist/mjs/data-structures/graph/abstract-graph.js +43 -12
- package/dist/mjs/data-structures/graph/directed-graph.d.ts +2 -2
- package/dist/mjs/data-structures/graph/directed-graph.js +2 -2
- package/dist/mjs/data-structures/graph/undirected-graph.d.ts +1 -1
- package/dist/mjs/data-structures/graph/undirected-graph.js +1 -1
- package/dist/mjs/data-structures/hash/hash-map.d.ts +9 -9
- package/dist/mjs/data-structures/hash/hash-map.js +16 -15
- package/dist/mjs/data-structures/heap/heap.d.ts +6 -35
- package/dist/mjs/data-structures/heap/heap.js +10 -42
- package/dist/mjs/data-structures/linked-list/doubly-linked-list.d.ts +99 -105
- package/dist/mjs/data-structures/linked-list/doubly-linked-list.js +142 -145
- package/dist/mjs/data-structures/linked-list/singly-linked-list.d.ts +16 -21
- package/dist/mjs/data-structures/linked-list/singly-linked-list.js +43 -43
- package/dist/mjs/data-structures/linked-list/skip-linked-list.d.ts +25 -25
- package/dist/mjs/data-structures/linked-list/skip-linked-list.js +36 -36
- package/dist/mjs/data-structures/queue/deque.d.ts +70 -75
- package/dist/mjs/data-structures/queue/deque.js +100 -110
- package/dist/mjs/data-structures/queue/queue.d.ts +37 -38
- package/dist/mjs/data-structures/queue/queue.js +45 -48
- package/dist/mjs/data-structures/stack/stack.d.ts +2 -3
- package/dist/mjs/data-structures/stack/stack.js +2 -5
- package/dist/mjs/data-structures/trie/trie.d.ts +1 -2
- package/dist/mjs/data-structures/trie/trie.js +2 -5
- package/dist/umd/data-structure-typed.js +531 -532
- package/dist/umd/data-structure-typed.min.js +2 -2
- package/dist/umd/data-structure-typed.min.js.map +1 -1
- package/package.json +1 -1
- package/src/data-structures/base/iterable-base.ts +24 -0
- package/src/data-structures/graph/abstract-graph.ts +55 -14
- package/src/data-structures/graph/directed-graph.ts +3 -2
- package/src/data-structures/graph/undirected-graph.ts +1 -1
- package/src/data-structures/hash/hash-map.ts +27 -28
- package/src/data-structures/heap/heap.ts +19 -57
- package/src/data-structures/linked-list/doubly-linked-list.ts +157 -161
- package/src/data-structures/linked-list/singly-linked-list.ts +49 -49
- package/src/data-structures/linked-list/skip-linked-list.ts +40 -40
- package/src/data-structures/queue/deque.ts +122 -135
- package/src/data-structures/queue/queue.ts +54 -58
- package/src/data-structures/stack/stack.ts +4 -8
- package/src/data-structures/trie/trie.ts +5 -9
- package/test/performance/data-structures/comparison/comparison.test.ts +6 -6
- package/test/performance/data-structures/heap/heap.test.ts +2 -2
- package/test/performance/data-structures/linked-list/doubly-linked-list.test.ts +2 -2
- package/test/performance/data-structures/linked-list/singly-linked-list.test.ts +2 -2
- package/test/performance/data-structures/priority-queue/priority-queue.test.ts +2 -2
- package/test/unit/data-structures/binary-tree/binary-tree.test.ts +2 -2
- package/test/unit/data-structures/graph/abstract-graph.test.ts +1 -1
- package/test/unit/data-structures/graph/directed-graph.test.ts +48 -3
- package/test/unit/data-structures/graph/undirected-graph.test.ts +48 -4
- package/test/unit/data-structures/hash/hash-map.test.ts +2 -2
- package/test/unit/data-structures/heap/heap.test.ts +6 -1
- package/test/unit/data-structures/heap/min-heap.test.ts +1 -1
- package/test/unit/data-structures/linked-list/doubly-linked-list.test.ts +30 -30
- package/test/unit/data-structures/linked-list/linked-list.test.ts +1 -1
- package/test/unit/data-structures/linked-list/singly-linked-list.test.ts +21 -21
- package/test/unit/data-structures/linked-list/skip-list.test.ts +2 -2
- package/test/unit/data-structures/queue/deque.test.ts +5 -5
- package/test/unit/data-structures/queue/queue.test.ts +4 -4
- package/test/unit/data-structures/trie/trie.test.ts +1 -1
package/benchmark/report.json
CHANGED
|
@@ -1,55 +1,490 @@
|
|
|
1
1
|
{
|
|
2
|
+
"avl-tree": {
|
|
3
|
+
"benchmarks": [
|
|
4
|
+
{
|
|
5
|
+
"test name": "10,000 add randomly",
|
|
6
|
+
"time taken (ms)": "50.74",
|
|
7
|
+
"executions per sec": "19.71",
|
|
8
|
+
"sample deviation": "0.00"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"test name": "10,000 add & delete randomly",
|
|
12
|
+
"time taken (ms)": "127.76",
|
|
13
|
+
"executions per sec": "7.83",
|
|
14
|
+
"sample deviation": "0.02"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"test name": "10,000 addMany",
|
|
18
|
+
"time taken (ms)": "57.14",
|
|
19
|
+
"executions per sec": "17.50",
|
|
20
|
+
"sample deviation": "0.00"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"test name": "10,000 get",
|
|
24
|
+
"time taken (ms)": "52.22",
|
|
25
|
+
"executions per sec": "19.15",
|
|
26
|
+
"sample deviation": "0.01"
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
"testName": "avl-tree"
|
|
30
|
+
},
|
|
2
31
|
"binary-tree": {
|
|
3
32
|
"benchmarks": [
|
|
4
33
|
{
|
|
5
34
|
"test name": "1,000 add randomly",
|
|
6
|
-
"time taken (ms)": "
|
|
7
|
-
"executions per sec": "
|
|
8
|
-
"sample deviation": "
|
|
35
|
+
"time taken (ms)": "18.32",
|
|
36
|
+
"executions per sec": "54.59",
|
|
37
|
+
"sample deviation": "0.00"
|
|
9
38
|
},
|
|
10
39
|
{
|
|
11
40
|
"test name": "1,000 add & delete randomly",
|
|
12
|
-
"time taken (ms)": "
|
|
13
|
-
"executions per sec": "
|
|
14
|
-
"sample deviation": "0.
|
|
41
|
+
"time taken (ms)": "26.54",
|
|
42
|
+
"executions per sec": "37.69",
|
|
43
|
+
"sample deviation": "0.01"
|
|
15
44
|
},
|
|
16
45
|
{
|
|
17
46
|
"test name": "1,000 addMany",
|
|
18
|
-
"time taken (ms)": "
|
|
19
|
-
"executions per sec": "
|
|
47
|
+
"time taken (ms)": "18.79",
|
|
48
|
+
"executions per sec": "53.22",
|
|
20
49
|
"sample deviation": "0.00"
|
|
21
50
|
},
|
|
22
51
|
{
|
|
23
52
|
"test name": "1,000 get",
|
|
24
|
-
"time taken (ms)": "
|
|
25
|
-
"executions per sec": "
|
|
53
|
+
"time taken (ms)": "18.95",
|
|
54
|
+
"executions per sec": "52.78",
|
|
26
55
|
"sample deviation": "0.00"
|
|
27
56
|
},
|
|
28
57
|
{
|
|
29
58
|
"test name": "1,000 has",
|
|
30
|
-
"time taken (ms)": "
|
|
31
|
-
"executions per sec": "
|
|
32
|
-
"sample deviation": "
|
|
59
|
+
"time taken (ms)": "19.76",
|
|
60
|
+
"executions per sec": "50.60",
|
|
61
|
+
"sample deviation": "0.01"
|
|
33
62
|
},
|
|
34
63
|
{
|
|
35
64
|
"test name": "1,000 dfs",
|
|
36
|
-
"time taken (ms)": "
|
|
37
|
-
"executions per sec": "6.
|
|
38
|
-
"sample deviation": "0.
|
|
65
|
+
"time taken (ms)": "159.96",
|
|
66
|
+
"executions per sec": "6.25",
|
|
67
|
+
"sample deviation": "0.01"
|
|
39
68
|
},
|
|
40
69
|
{
|
|
41
70
|
"test name": "1,000 bfs",
|
|
42
|
-
"time taken (ms)": "
|
|
43
|
-
"executions per sec": "
|
|
44
|
-
"sample deviation": "0.
|
|
71
|
+
"time taken (ms)": "73.63",
|
|
72
|
+
"executions per sec": "13.58",
|
|
73
|
+
"sample deviation": "0.08"
|
|
45
74
|
},
|
|
46
75
|
{
|
|
47
76
|
"test name": "1,000 morris",
|
|
48
|
-
"time taken (ms)": "
|
|
49
|
-
"executions per sec": "
|
|
50
|
-
"sample deviation": "0.
|
|
77
|
+
"time taken (ms)": "225.93",
|
|
78
|
+
"executions per sec": "4.43",
|
|
79
|
+
"sample deviation": "0.05"
|
|
51
80
|
}
|
|
52
81
|
],
|
|
53
82
|
"testName": "binary-tree"
|
|
83
|
+
},
|
|
84
|
+
"bst": {
|
|
85
|
+
"benchmarks": [
|
|
86
|
+
{
|
|
87
|
+
"test name": "10,000 add randomly",
|
|
88
|
+
"time taken (ms)": "48.80",
|
|
89
|
+
"executions per sec": "20.49",
|
|
90
|
+
"sample deviation": "2.79e-4"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"test name": "10,000 add & delete randomly",
|
|
94
|
+
"time taken (ms)": "110.72",
|
|
95
|
+
"executions per sec": "9.03",
|
|
96
|
+
"sample deviation": "0.00"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"test name": "10,000 addMany",
|
|
100
|
+
"time taken (ms)": "46.19",
|
|
101
|
+
"executions per sec": "21.65",
|
|
102
|
+
"sample deviation": "0.00"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"test name": "10,000 get",
|
|
106
|
+
"time taken (ms)": "49.28",
|
|
107
|
+
"executions per sec": "20.29",
|
|
108
|
+
"sample deviation": "7.92e-4"
|
|
109
|
+
}
|
|
110
|
+
],
|
|
111
|
+
"testName": "bst"
|
|
112
|
+
},
|
|
113
|
+
"rb-tree": {
|
|
114
|
+
"benchmarks": [
|
|
115
|
+
{
|
|
116
|
+
"test name": "100,000 add",
|
|
117
|
+
"time taken (ms)": "80.84",
|
|
118
|
+
"executions per sec": "12.37",
|
|
119
|
+
"sample deviation": "0.00"
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"test name": "100,000 add & delete randomly",
|
|
123
|
+
"time taken (ms)": "206.65",
|
|
124
|
+
"executions per sec": "4.84",
|
|
125
|
+
"sample deviation": "0.01"
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"test name": "100,000 getNode",
|
|
129
|
+
"time taken (ms)": "57.42",
|
|
130
|
+
"executions per sec": "17.42",
|
|
131
|
+
"sample deviation": "0.00"
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
"test name": "100,000 add & iterator",
|
|
135
|
+
"time taken (ms)": "109.59",
|
|
136
|
+
"executions per sec": "9.12",
|
|
137
|
+
"sample deviation": "0.00"
|
|
138
|
+
}
|
|
139
|
+
],
|
|
140
|
+
"testName": "rb-tree"
|
|
141
|
+
},
|
|
142
|
+
"comparison": {
|
|
143
|
+
"benchmarks": [
|
|
144
|
+
{
|
|
145
|
+
"test name": "SRC PQ 10,000 add",
|
|
146
|
+
"time taken (ms)": "0.14",
|
|
147
|
+
"executions per sec": "6917.74",
|
|
148
|
+
"sample deviation": "1.81e-6"
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
"test name": "CJS PQ 10,000 add",
|
|
152
|
+
"time taken (ms)": "0.15",
|
|
153
|
+
"executions per sec": "6883.53",
|
|
154
|
+
"sample deviation": "3.84e-6"
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
"test name": "MJS PQ 10,000 add",
|
|
158
|
+
"time taken (ms)": "0.57",
|
|
159
|
+
"executions per sec": "1761.70",
|
|
160
|
+
"sample deviation": "5.07e-6"
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
"test name": "SRC PQ 10,000 add & poll",
|
|
164
|
+
"time taken (ms)": "3.45",
|
|
165
|
+
"executions per sec": "289.74",
|
|
166
|
+
"sample deviation": "3.63e-4"
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
"test name": "CJS PQ 10,000 add & poll",
|
|
170
|
+
"time taken (ms)": "3.53",
|
|
171
|
+
"executions per sec": "283.14",
|
|
172
|
+
"sample deviation": "4.73e-5"
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
"test name": "MJS PQ 10,000 add & poll",
|
|
176
|
+
"time taken (ms)": "3.31",
|
|
177
|
+
"executions per sec": "302.38",
|
|
178
|
+
"sample deviation": "3.64e-5"
|
|
179
|
+
}
|
|
180
|
+
],
|
|
181
|
+
"testName": "comparison"
|
|
182
|
+
},
|
|
183
|
+
"directed-graph": {
|
|
184
|
+
"benchmarks": [
|
|
185
|
+
{
|
|
186
|
+
"test name": "1,000 addVertex",
|
|
187
|
+
"time taken (ms)": "0.10",
|
|
188
|
+
"executions per sec": "9860.53",
|
|
189
|
+
"sample deviation": "9.32e-7"
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
"test name": "1,000 addEdge",
|
|
193
|
+
"time taken (ms)": "6.34",
|
|
194
|
+
"executions per sec": "157.71",
|
|
195
|
+
"sample deviation": "8.55e-4"
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
"test name": "1,000 getVertex",
|
|
199
|
+
"time taken (ms)": "0.05",
|
|
200
|
+
"executions per sec": "2.16e+4",
|
|
201
|
+
"sample deviation": "4.61e-7"
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
"test name": "1,000 getEdge",
|
|
205
|
+
"time taken (ms)": "22.67",
|
|
206
|
+
"executions per sec": "44.12",
|
|
207
|
+
"sample deviation": "0.00"
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
"test name": "tarjan",
|
|
211
|
+
"time taken (ms)": "217.59",
|
|
212
|
+
"executions per sec": "4.60",
|
|
213
|
+
"sample deviation": "0.01"
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
"test name": "tarjan all",
|
|
217
|
+
"time taken (ms)": "6489.86",
|
|
218
|
+
"executions per sec": "0.15",
|
|
219
|
+
"sample deviation": "0.09"
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
"test name": "topologicalSort",
|
|
223
|
+
"time taken (ms)": "179.22",
|
|
224
|
+
"executions per sec": "5.58",
|
|
225
|
+
"sample deviation": "0.00"
|
|
226
|
+
}
|
|
227
|
+
],
|
|
228
|
+
"testName": "directed-graph"
|
|
229
|
+
},
|
|
230
|
+
"hash-map": {
|
|
231
|
+
"benchmarks": [
|
|
232
|
+
{
|
|
233
|
+
"test name": "1,000,000 set",
|
|
234
|
+
"time taken (ms)": "108.75",
|
|
235
|
+
"executions per sec": "9.20",
|
|
236
|
+
"sample deviation": "0.04"
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
"test name": "Native Map 1,000,000 set",
|
|
240
|
+
"time taken (ms)": "217.55",
|
|
241
|
+
"executions per sec": "4.60",
|
|
242
|
+
"sample deviation": "0.02"
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
"test name": "Native Set 1,000,000 add",
|
|
246
|
+
"time taken (ms)": "179.67",
|
|
247
|
+
"executions per sec": "5.57",
|
|
248
|
+
"sample deviation": "0.03"
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
"test name": "1,000,000 set & get",
|
|
252
|
+
"time taken (ms)": "122.66",
|
|
253
|
+
"executions per sec": "8.15",
|
|
254
|
+
"sample deviation": "0.03"
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
"test name": "Native Map 1,000,000 set & get",
|
|
258
|
+
"time taken (ms)": "282.47",
|
|
259
|
+
"executions per sec": "3.54",
|
|
260
|
+
"sample deviation": "0.04"
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
"test name": "Native Set 1,000,000 add & has",
|
|
264
|
+
"time taken (ms)": "174.48",
|
|
265
|
+
"executions per sec": "5.73",
|
|
266
|
+
"sample deviation": "0.02"
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
"test name": "1,000,000 ObjKey set & get",
|
|
270
|
+
"time taken (ms)": "336.83",
|
|
271
|
+
"executions per sec": "2.97",
|
|
272
|
+
"sample deviation": "0.06"
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
"test name": "Native Map 1,000,000 ObjKey set & get",
|
|
276
|
+
"time taken (ms)": "314.00",
|
|
277
|
+
"executions per sec": "3.18",
|
|
278
|
+
"sample deviation": "0.06"
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
"test name": "Native Set 1,000,000 ObjKey add & has",
|
|
282
|
+
"time taken (ms)": "267.84",
|
|
283
|
+
"executions per sec": "3.73",
|
|
284
|
+
"sample deviation": "0.03"
|
|
285
|
+
}
|
|
286
|
+
],
|
|
287
|
+
"testName": "hash-map"
|
|
288
|
+
},
|
|
289
|
+
"heap": {
|
|
290
|
+
"benchmarks": [
|
|
291
|
+
{
|
|
292
|
+
"test name": "100,000 add & poll",
|
|
293
|
+
"time taken (ms)": "80.49",
|
|
294
|
+
"executions per sec": "12.42",
|
|
295
|
+
"sample deviation": "0.00"
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
"test name": "100,000 add & dfs",
|
|
299
|
+
"time taken (ms)": "34.01",
|
|
300
|
+
"executions per sec": "29.40",
|
|
301
|
+
"sample deviation": "3.88e-4"
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
"test name": "10,000 fib add & pop",
|
|
305
|
+
"time taken (ms)": "359.70",
|
|
306
|
+
"executions per sec": "2.78",
|
|
307
|
+
"sample deviation": "0.00"
|
|
308
|
+
}
|
|
309
|
+
],
|
|
310
|
+
"testName": "heap"
|
|
311
|
+
},
|
|
312
|
+
"doubly-linked-list": {
|
|
313
|
+
"benchmarks": [
|
|
314
|
+
{
|
|
315
|
+
"test name": "1,000,000 push",
|
|
316
|
+
"time taken (ms)": "229.17",
|
|
317
|
+
"executions per sec": "4.36",
|
|
318
|
+
"sample deviation": "0.06"
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
"test name": "1,000,000 unshift",
|
|
322
|
+
"time taken (ms)": "220.53",
|
|
323
|
+
"executions per sec": "4.53",
|
|
324
|
+
"sample deviation": "0.06"
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
"test name": "1,000,000 unshift & shift",
|
|
328
|
+
"time taken (ms)": "172.12",
|
|
329
|
+
"executions per sec": "5.81",
|
|
330
|
+
"sample deviation": "0.03"
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
"test name": "1,000,000 addBefore",
|
|
334
|
+
"time taken (ms)": "309.58",
|
|
335
|
+
"executions per sec": "3.23",
|
|
336
|
+
"sample deviation": "0.06"
|
|
337
|
+
}
|
|
338
|
+
],
|
|
339
|
+
"testName": "doubly-linked-list"
|
|
340
|
+
},
|
|
341
|
+
"singly-linked-list": {
|
|
342
|
+
"benchmarks": [
|
|
343
|
+
{
|
|
344
|
+
"test name": "1,000,000 push & shift",
|
|
345
|
+
"time taken (ms)": "211.62",
|
|
346
|
+
"executions per sec": "4.73",
|
|
347
|
+
"sample deviation": "0.06"
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
"test name": "10,000 push & pop",
|
|
351
|
+
"time taken (ms)": "219.72",
|
|
352
|
+
"executions per sec": "4.55",
|
|
353
|
+
"sample deviation": "0.03"
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
"test name": "10,000 addBefore",
|
|
357
|
+
"time taken (ms)": "249.09",
|
|
358
|
+
"executions per sec": "4.01",
|
|
359
|
+
"sample deviation": "0.01"
|
|
360
|
+
}
|
|
361
|
+
],
|
|
362
|
+
"testName": "singly-linked-list"
|
|
363
|
+
},
|
|
364
|
+
"max-priority-queue": {
|
|
365
|
+
"benchmarks": [
|
|
366
|
+
{
|
|
367
|
+
"test name": "10,000 refill & poll",
|
|
368
|
+
"time taken (ms)": "8.96",
|
|
369
|
+
"executions per sec": "111.61",
|
|
370
|
+
"sample deviation": "1.80e-4"
|
|
371
|
+
}
|
|
372
|
+
],
|
|
373
|
+
"testName": "max-priority-queue"
|
|
374
|
+
},
|
|
375
|
+
"priority-queue": {
|
|
376
|
+
"benchmarks": [
|
|
377
|
+
{
|
|
378
|
+
"test name": "100,000 add & poll",
|
|
379
|
+
"time taken (ms)": "106.14",
|
|
380
|
+
"executions per sec": "9.42",
|
|
381
|
+
"sample deviation": "0.00"
|
|
382
|
+
}
|
|
383
|
+
],
|
|
384
|
+
"testName": "priority-queue"
|
|
385
|
+
},
|
|
386
|
+
"deque": {
|
|
387
|
+
"benchmarks": [
|
|
388
|
+
{
|
|
389
|
+
"test name": "1,000,000 push",
|
|
390
|
+
"time taken (ms)": "13.91",
|
|
391
|
+
"executions per sec": "71.89",
|
|
392
|
+
"sample deviation": "4.15e-4"
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
"test name": "1,000,000 push & pop",
|
|
396
|
+
"time taken (ms)": "22.82",
|
|
397
|
+
"executions per sec": "43.83",
|
|
398
|
+
"sample deviation": "2.45e-4"
|
|
399
|
+
},
|
|
400
|
+
{
|
|
401
|
+
"test name": "100,000 push & shift",
|
|
402
|
+
"time taken (ms)": "2.38",
|
|
403
|
+
"executions per sec": "420.49",
|
|
404
|
+
"sample deviation": "3.61e-5"
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
"test name": "Native Array 100,000 push & shift",
|
|
408
|
+
"time taken (ms)": "2718.62",
|
|
409
|
+
"executions per sec": "0.37",
|
|
410
|
+
"sample deviation": "0.35"
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
"test name": "100,000 unshift & shift",
|
|
414
|
+
"time taken (ms)": "2.28",
|
|
415
|
+
"executions per sec": "438.78",
|
|
416
|
+
"sample deviation": "4.18e-4"
|
|
417
|
+
},
|
|
418
|
+
{
|
|
419
|
+
"test name": "Native Array 100,000 unshift & shift",
|
|
420
|
+
"time taken (ms)": "4065.01",
|
|
421
|
+
"executions per sec": "0.25",
|
|
422
|
+
"sample deviation": "0.21"
|
|
423
|
+
}
|
|
424
|
+
],
|
|
425
|
+
"testName": "deque"
|
|
426
|
+
},
|
|
427
|
+
"queue": {
|
|
428
|
+
"benchmarks": [
|
|
429
|
+
{
|
|
430
|
+
"test name": "1,000,000 push",
|
|
431
|
+
"time taken (ms)": "44.46",
|
|
432
|
+
"executions per sec": "22.49",
|
|
433
|
+
"sample deviation": "0.01"
|
|
434
|
+
},
|
|
435
|
+
{
|
|
436
|
+
"test name": "100,000 push & shift",
|
|
437
|
+
"time taken (ms)": "5.16",
|
|
438
|
+
"executions per sec": "193.83",
|
|
439
|
+
"sample deviation": "0.00"
|
|
440
|
+
},
|
|
441
|
+
{
|
|
442
|
+
"test name": "Native Array 100,000 push & shift",
|
|
443
|
+
"time taken (ms)": "2195.56",
|
|
444
|
+
"executions per sec": "0.46",
|
|
445
|
+
"sample deviation": "0.29"
|
|
446
|
+
},
|
|
447
|
+
{
|
|
448
|
+
"test name": "Native Array 100,000 push & pop",
|
|
449
|
+
"time taken (ms)": "4.40",
|
|
450
|
+
"executions per sec": "227.04",
|
|
451
|
+
"sample deviation": "0.00"
|
|
452
|
+
}
|
|
453
|
+
],
|
|
454
|
+
"testName": "queue"
|
|
455
|
+
},
|
|
456
|
+
"stack": {
|
|
457
|
+
"benchmarks": [
|
|
458
|
+
{
|
|
459
|
+
"test name": "1,000,000 push",
|
|
460
|
+
"time taken (ms)": "44.05",
|
|
461
|
+
"executions per sec": "22.70",
|
|
462
|
+
"sample deviation": "0.01"
|
|
463
|
+
},
|
|
464
|
+
{
|
|
465
|
+
"test name": "1,000,000 push & pop",
|
|
466
|
+
"time taken (ms)": "49.72",
|
|
467
|
+
"executions per sec": "20.11",
|
|
468
|
+
"sample deviation": "0.01"
|
|
469
|
+
}
|
|
470
|
+
],
|
|
471
|
+
"testName": "stack"
|
|
472
|
+
},
|
|
473
|
+
"trie": {
|
|
474
|
+
"benchmarks": [
|
|
475
|
+
{
|
|
476
|
+
"test name": "100,000 push",
|
|
477
|
+
"time taken (ms)": "44.33",
|
|
478
|
+
"executions per sec": "22.56",
|
|
479
|
+
"sample deviation": "0.00"
|
|
480
|
+
},
|
|
481
|
+
{
|
|
482
|
+
"test name": "100,000 getWords",
|
|
483
|
+
"time taken (ms)": "88.47",
|
|
484
|
+
"executions per sec": "11.30",
|
|
485
|
+
"sample deviation": "0.01"
|
|
486
|
+
}
|
|
487
|
+
],
|
|
488
|
+
"testName": "trie"
|
|
54
489
|
}
|
|
55
490
|
}
|
|
@@ -126,6 +126,12 @@ export declare abstract class IterableEntryBase<K = any, V = any> {
|
|
|
126
126
|
* all the elements in the collection.
|
|
127
127
|
*/
|
|
128
128
|
reduce<U>(callbackfn: ReduceEntryCallback<K, V, U>, initialValue: U): U;
|
|
129
|
+
hasValue(value: V): boolean;
|
|
130
|
+
/**
|
|
131
|
+
* Time Complexity: O(n)
|
|
132
|
+
* Space Complexity: O(n)
|
|
133
|
+
*/
|
|
134
|
+
print(): void;
|
|
129
135
|
protected abstract _getIterator(...args: any[]): IterableIterator<[K, V]>;
|
|
130
136
|
}
|
|
131
137
|
export declare abstract class IterableElementBase<V> {
|
|
@@ -228,5 +234,10 @@ export declare abstract class IterableElementBase<V> {
|
|
|
228
234
|
* all the elements in the array and applying the callback function to each element.
|
|
229
235
|
*/
|
|
230
236
|
reduce<U>(callbackfn: ReduceElementCallback<V, U>, initialValue: U): U;
|
|
237
|
+
/**
|
|
238
|
+
* Time Complexity: O(n)
|
|
239
|
+
* Space Complexity: O(n)
|
|
240
|
+
*/
|
|
241
|
+
print(): void;
|
|
231
242
|
protected abstract _getIterator(...args: any[]): IterableIterator<V>;
|
|
232
243
|
}
|
|
@@ -172,6 +172,20 @@ class IterableEntryBase {
|
|
|
172
172
|
}
|
|
173
173
|
return accumulator;
|
|
174
174
|
}
|
|
175
|
+
hasValue(value) {
|
|
176
|
+
for (const [, elementValue] of this) {
|
|
177
|
+
if (elementValue === value)
|
|
178
|
+
return true;
|
|
179
|
+
}
|
|
180
|
+
return false;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Time Complexity: O(n)
|
|
184
|
+
* Space Complexity: O(n)
|
|
185
|
+
*/
|
|
186
|
+
print() {
|
|
187
|
+
console.log([...this]);
|
|
188
|
+
}
|
|
175
189
|
}
|
|
176
190
|
exports.IterableEntryBase = IterableEntryBase;
|
|
177
191
|
class IterableElementBase {
|
|
@@ -308,6 +322,13 @@ class IterableElementBase {
|
|
|
308
322
|
}
|
|
309
323
|
return accumulator;
|
|
310
324
|
}
|
|
325
|
+
/**
|
|
326
|
+
* Time Complexity: O(n)
|
|
327
|
+
* Space Complexity: O(n)
|
|
328
|
+
*/
|
|
329
|
+
print() {
|
|
330
|
+
console.log([...this]);
|
|
331
|
+
}
|
|
311
332
|
}
|
|
312
333
|
exports.IterableElementBase = IterableElementBase;
|
|
313
334
|
//# sourceMappingURL=iterable-base.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iterable-base.js","sourceRoot":"","sources":["../../../../src/data-structures/base/iterable-base.ts"],"names":[],"mappings":";;;AAEA,MAAsB,iBAAiB;IAErC;;;OAGG;IAEH;;;;;;;;OAQG;IACH,CAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,GAAG,IAAW;QAChC,KAAK,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC,CAAC;IACpC,CAAC;IAED;;;OAGG;IACH;;;;;;OAMG;IACH,CAAE,OAAO;QACP,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE,CAAC;YACxB,MAAM,IAAI,CAAC;QACb,CAAC;IACH,CAAC;IAED;;;OAGG;IACH;;;;;OAKG;IACH,CAAE,IAAI;QACJ,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE,CAAC;YACxB,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC;QAChB,CAAC;IACH,CAAC;IAED;;;OAGG;IACH;;;;;OAKG;IACH,CAAE,MAAM;QACN,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE,CAAC;YACxB,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC;QAChB,CAAC;IACH,CAAC;IAED;;;OA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AC;QAC/B,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE,CAAC;YACxB,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,IAAI,CAAC;YAC1B,WAAW,GAAG,UAAU,CAAC,WAAW,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,IAAI,CAAC,CAAA;QAClE,CAAC;QACD,OAAO,WAAW,CAAC;IACrB,CAAC;CAGF;
|
|
1
|
+
{"version":3,"file":"iterable-base.js","sourceRoot":"","sources":["../../../../src/data-structures/base/iterable-base.ts"],"names":[],"mappings":";;;AAEA,MAAsB,iBAAiB;IAErC;;;OAGG;IAEH;;;;;;;;OAQG;IACH,CAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,GAAG,IAAW;QAChC,KAAK,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC,CAAC;IACpC,CAAC;IAED;;;OAGG;IACH;;;;;;OAMG;IACH,CAAE,OAAO;QACP,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE,CAAC;YACxB,MAAM,IAAI,CAAC;QACb,CAAC;IACH,CAAC;IAED;;;OAGG;IACH;;;;;OAKG;IACH,CAAE,IAAI;QACJ,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE,CAAC;YACxB,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC;QAChB,CAAC;IACH,CAAC;IAED;;;OAGG;IACH;;;;;OAKG;IACH,CAAE,MAAM;QACN,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE,CAAC;YACxB,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC;QAChB,CAAC;IACH,CAAC;IAED;;;OAGG;IACH;;;;;;;;;;;;;OAaG;IACH,KAAK,CAAC,SAAuC,EAAE,OAAa;QAC1D,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE,CAAC;YACxB,IAAI,CAAC,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C,CAAC;QACd,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE,CAAC;YACxB,IAAI,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,IAAS,EAAE,KAAK,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC;gBACtD,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;OAGG;IACH;;;;;;;;;;;;OAYG;IACH,OAAO,CAAC,UAAoC,EAAE,OAAa;QACzD,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE,CAAC;YACxB,UAAU,CAAC,IAAI,CAAC,OAAO,EAAE,IAAS,EAAE,KAAK,EAAE,EAAE,IAAI,CAAC,CAAA;QACpD,CAAC;IACH,CAAC;IAED;;;OAGG;IACH;;;;;;;;;;;;OAYG;IACH,MAAM,CAAI,UAAuC,EAAE,YAAe;QAChE,IAAI,WAAW,GAAG,YAAY,CAAC;QAC/B,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE,CAAC;YACxB,WAAW,GAAG,UAAU,CAAC,WAAW,EAAE,IAAS,EAAE,KAAK,EAAE,EAAE,IAAI,CAAC,CAAA;QACjE,CAAC;QACD,OAAO,WAAW,CAAC;IACrB,CAAC;IAGD;;;OAGG;IACH,KAAK;QACH,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAA;IACxB,CAAC;CAGF;AAvJD,kDAuJC"}
|
|
@@ -432,11 +432,6 @@ export declare abstract class AbstractGraph<V = any, E = any, VO extends Abstrac
|
|
|
432
432
|
* type `number`.
|
|
433
433
|
*/
|
|
434
434
|
getLowMap(): Map<VO, number>;
|
|
435
|
-
/**
|
|
436
|
-
* The function `getCycles` returns a map of cycles found using the Tarjan algorithm.
|
|
437
|
-
* @returns The function `getCycles()` is returning a `Map<number, VO[]>`.
|
|
438
|
-
*/
|
|
439
|
-
getCycles(): Map<number, VO[]>;
|
|
440
435
|
/**
|
|
441
436
|
* The function "getCutVertexes" returns an array of cut vertexes using the Tarjan algorithm.
|
|
442
437
|
* @returns an array of VO objects, specifically the cut vertexes.
|
|
@@ -453,6 +448,11 @@ export declare abstract class AbstractGraph<V = any, E = any, VO extends Abstrac
|
|
|
453
448
|
* @returns the bridges found using the Tarjan algorithm.
|
|
454
449
|
*/
|
|
455
450
|
getBridges(): EO[];
|
|
451
|
+
/**
|
|
452
|
+
* O(V+E+C)
|
|
453
|
+
* O(V+C)
|
|
454
|
+
*/
|
|
455
|
+
getCycles(isInclude2Cycle?: boolean): VertexKey[][];
|
|
456
456
|
/**
|
|
457
457
|
* Time Complexity: O(n)
|
|
458
458
|
* Space Complexity: O(n)
|
|
@@ -493,8 +493,8 @@ export declare abstract class AbstractGraph<V = any, E = any, VO extends Abstrac
|
|
|
493
493
|
*/
|
|
494
494
|
map<T>(callback: EntryCallback<VertexKey, V | undefined, T>, thisArg?: any): T[];
|
|
495
495
|
protected _getIterator(): IterableIterator<[VertexKey, V | undefined]>;
|
|
496
|
-
protected abstract
|
|
497
|
-
protected
|
|
496
|
+
protected abstract _addEdge(edge: EO): boolean;
|
|
497
|
+
protected _addVertex(newVertex: VO): boolean;
|
|
498
498
|
protected _getVertex(vertexOrKey: VertexKey | VO): VO | undefined;
|
|
499
499
|
protected _getVertexKey(vertexOrKey: VO | VertexKey): VertexKey;
|
|
500
500
|
}
|