data-structure-typed 1.51.1 → 1.51.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 +208 -185
- package/benchmark/report.html +13 -13
- package/benchmark/report.json +158 -146
- package/dist/cjs/data-structures/binary-tree/binary-tree.d.ts +16 -10
- package/dist/cjs/data-structures/binary-tree/binary-tree.js +31 -25
- package/dist/cjs/data-structures/binary-tree/binary-tree.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/bst.d.ts +27 -1
- package/dist/cjs/data-structures/binary-tree/bst.js +29 -0
- package/dist/cjs/data-structures/binary-tree/bst.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/rb-tree.d.ts +1 -47
- package/dist/cjs/data-structures/binary-tree/rb-tree.js +6 -61
- package/dist/cjs/data-structures/binary-tree/rb-tree.js.map +1 -1
- package/dist/mjs/data-structures/binary-tree/binary-tree.d.ts +16 -10
- package/dist/mjs/data-structures/binary-tree/binary-tree.js +31 -25
- package/dist/mjs/data-structures/binary-tree/bst.d.ts +27 -1
- package/dist/mjs/data-structures/binary-tree/bst.js +28 -0
- package/dist/mjs/data-structures/binary-tree/rb-tree.d.ts +1 -47
- package/dist/mjs/data-structures/binary-tree/rb-tree.js +6 -60
- package/dist/umd/data-structure-typed.js +66 -86
- package/dist/umd/data-structure-typed.min.js +2 -2
- package/dist/umd/data-structure-typed.min.js.map +1 -1
- package/package.json +92 -69
- package/src/data-structures/binary-tree/binary-tree.ts +33 -28
- package/src/data-structures/binary-tree/bst.ts +36 -1
- package/src/data-structures/binary-tree/rb-tree.ts +6 -72
- package/test/performance/data-structures/binary-tree/avl-tree.test.ts +4 -0
- package/test/performance/data-structures/binary-tree/rb-tree.test.ts +4 -0
- package/test/unit/data-structures/binary-tree/overall.test.ts +2 -2
- package/test/unit/data-structures/binary-tree/rb-tree.test.ts +40 -40
package/benchmark/report.json
CHANGED
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
"benchmarks": [
|
|
4
4
|
{
|
|
5
5
|
"test name": "100,000 add",
|
|
6
|
-
"time taken (ms)": "6.
|
|
7
|
-
"executions per sec": "
|
|
8
|
-
"sample deviation": "1.
|
|
6
|
+
"time taken (ms)": "6.44",
|
|
7
|
+
"executions per sec": "155.39",
|
|
8
|
+
"sample deviation": "1.89e-4"
|
|
9
9
|
},
|
|
10
10
|
{
|
|
11
11
|
"test name": "100,000 add & poll",
|
|
12
|
-
"time taken (ms)": "
|
|
13
|
-
"executions per sec": "
|
|
14
|
-
"sample deviation": "
|
|
12
|
+
"time taken (ms)": "31.54",
|
|
13
|
+
"executions per sec": "31.71",
|
|
14
|
+
"sample deviation": "7.91e-4"
|
|
15
15
|
}
|
|
16
16
|
],
|
|
17
17
|
"testName": "heap"
|
|
@@ -20,32 +20,38 @@
|
|
|
20
20
|
"benchmarks": [
|
|
21
21
|
{
|
|
22
22
|
"test name": "100,000 add",
|
|
23
|
-
"time taken (ms)": "55.
|
|
24
|
-
"executions per sec": "
|
|
23
|
+
"time taken (ms)": "55.64",
|
|
24
|
+
"executions per sec": "17.97",
|
|
25
|
+
"sample deviation": "3.93e-4"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"test name": "100,000 add randomly",
|
|
29
|
+
"time taken (ms)": "70.35",
|
|
30
|
+
"executions per sec": "14.21",
|
|
25
31
|
"sample deviation": "0.00"
|
|
26
32
|
},
|
|
27
33
|
{
|
|
28
34
|
"test name": "100,000 get",
|
|
29
|
-
"time taken (ms)": "
|
|
30
|
-
"executions per sec": "8.
|
|
35
|
+
"time taken (ms)": "115.51",
|
|
36
|
+
"executions per sec": "8.66",
|
|
31
37
|
"sample deviation": "0.00"
|
|
32
38
|
},
|
|
33
39
|
{
|
|
34
40
|
"test name": "100,000 iterator",
|
|
35
|
-
"time taken (ms)": "
|
|
36
|
-
"executions per sec": "
|
|
41
|
+
"time taken (ms)": "27.64",
|
|
42
|
+
"executions per sec": "36.18",
|
|
37
43
|
"sample deviation": "0.01"
|
|
38
44
|
},
|
|
39
45
|
{
|
|
40
46
|
"test name": "100,000 add & delete orderly",
|
|
41
|
-
"time taken (ms)": "
|
|
42
|
-
"executions per sec": "
|
|
43
|
-
"sample deviation": "0.
|
|
47
|
+
"time taken (ms)": "120.73",
|
|
48
|
+
"executions per sec": "8.28",
|
|
49
|
+
"sample deviation": "0.00"
|
|
44
50
|
},
|
|
45
51
|
{
|
|
46
52
|
"test name": "100,000 add & delete randomly",
|
|
47
|
-
"time taken (ms)": "
|
|
48
|
-
"executions per sec": "4.
|
|
53
|
+
"time taken (ms)": "223.37",
|
|
54
|
+
"executions per sec": "4.48",
|
|
49
55
|
"sample deviation": "0.00"
|
|
50
56
|
}
|
|
51
57
|
],
|
|
@@ -55,21 +61,21 @@
|
|
|
55
61
|
"benchmarks": [
|
|
56
62
|
{
|
|
57
63
|
"test name": "1,000,000 push",
|
|
58
|
-
"time taken (ms)": "
|
|
59
|
-
"executions per sec": "
|
|
64
|
+
"time taken (ms)": "42.87",
|
|
65
|
+
"executions per sec": "23.33",
|
|
60
66
|
"sample deviation": "0.01"
|
|
61
67
|
},
|
|
62
68
|
{
|
|
63
69
|
"test name": "100,000 push & shift",
|
|
64
|
-
"time taken (ms)": "4.
|
|
65
|
-
"executions per sec": "
|
|
66
|
-
"sample deviation": "
|
|
70
|
+
"time taken (ms)": "4.87",
|
|
71
|
+
"executions per sec": "205.17",
|
|
72
|
+
"sample deviation": "6.94e-4"
|
|
67
73
|
},
|
|
68
74
|
{
|
|
69
75
|
"test name": "Native JS Array 100,000 push & shift",
|
|
70
|
-
"time taken (ms)": "
|
|
71
|
-
"executions per sec": "0.
|
|
72
|
-
"sample deviation": "0.
|
|
76
|
+
"time taken (ms)": "2196.84",
|
|
77
|
+
"executions per sec": "0.46",
|
|
78
|
+
"sample deviation": "0.19"
|
|
73
79
|
}
|
|
74
80
|
],
|
|
75
81
|
"testName": "queue"
|
|
@@ -78,45 +84,45 @@
|
|
|
78
84
|
"benchmarks": [
|
|
79
85
|
{
|
|
80
86
|
"test name": "1,000,000 push",
|
|
81
|
-
"time taken (ms)": "
|
|
82
|
-
"executions per sec": "
|
|
83
|
-
"sample deviation": "0.
|
|
87
|
+
"time taken (ms)": "23.68",
|
|
88
|
+
"executions per sec": "42.22",
|
|
89
|
+
"sample deviation": "0.00"
|
|
84
90
|
},
|
|
85
91
|
{
|
|
86
92
|
"test name": "1,000,000 push & pop",
|
|
87
|
-
"time taken (ms)": "30.
|
|
88
|
-
"executions per sec": "32.
|
|
93
|
+
"time taken (ms)": "30.68",
|
|
94
|
+
"executions per sec": "32.60",
|
|
89
95
|
"sample deviation": "0.00"
|
|
90
96
|
},
|
|
91
97
|
{
|
|
92
98
|
"test name": "1,000,000 push & shift",
|
|
93
|
-
"time taken (ms)": "30.
|
|
94
|
-
"executions per sec": "32.
|
|
99
|
+
"time taken (ms)": "30.49",
|
|
100
|
+
"executions per sec": "32.80",
|
|
95
101
|
"sample deviation": "0.00"
|
|
96
102
|
},
|
|
97
103
|
{
|
|
98
104
|
"test name": "100,000 push & shift",
|
|
99
|
-
"time taken (ms)": "3.
|
|
100
|
-
"executions per sec": "
|
|
101
|
-
"sample deviation": "2.
|
|
105
|
+
"time taken (ms)": "3.21",
|
|
106
|
+
"executions per sec": "311.51",
|
|
107
|
+
"sample deviation": "2.41e-4"
|
|
102
108
|
},
|
|
103
109
|
{
|
|
104
110
|
"test name": "Native JS Array 100,000 push & shift",
|
|
105
|
-
"time taken (ms)": "
|
|
111
|
+
"time taken (ms)": "2510.08",
|
|
106
112
|
"executions per sec": "0.40",
|
|
107
|
-
"sample deviation": "0.
|
|
113
|
+
"sample deviation": "0.34"
|
|
108
114
|
},
|
|
109
115
|
{
|
|
110
116
|
"test name": "100,000 unshift & shift",
|
|
111
|
-
"time taken (ms)": "2.
|
|
112
|
-
"executions per sec": "
|
|
113
|
-
"sample deviation": "2.
|
|
117
|
+
"time taken (ms)": "2.89",
|
|
118
|
+
"executions per sec": "346.57",
|
|
119
|
+
"sample deviation": "2.98e-4"
|
|
114
120
|
},
|
|
115
121
|
{
|
|
116
122
|
"test name": "Native JS Array 100,000 unshift & shift",
|
|
117
|
-
"time taken (ms)": "
|
|
118
|
-
"executions per sec": "0.
|
|
119
|
-
"sample deviation": "0.
|
|
123
|
+
"time taken (ms)": "4581.65",
|
|
124
|
+
"executions per sec": "0.22",
|
|
125
|
+
"sample deviation": "0.40"
|
|
120
126
|
}
|
|
121
127
|
],
|
|
122
128
|
"testName": "deque"
|
|
@@ -125,57 +131,57 @@
|
|
|
125
131
|
"benchmarks": [
|
|
126
132
|
{
|
|
127
133
|
"test name": "1,000,000 set",
|
|
128
|
-
"time taken (ms)": "
|
|
129
|
-
"executions per sec": "8.
|
|
130
|
-
"sample deviation": "0.
|
|
134
|
+
"time taken (ms)": "120.66",
|
|
135
|
+
"executions per sec": "8.29",
|
|
136
|
+
"sample deviation": "0.03"
|
|
131
137
|
},
|
|
132
138
|
{
|
|
133
139
|
"test name": "Native JS Map 1,000,000 set",
|
|
134
|
-
"time taken (ms)": "
|
|
135
|
-
"executions per sec": "4.
|
|
136
|
-
"sample deviation": "0.
|
|
140
|
+
"time taken (ms)": "202.57",
|
|
141
|
+
"executions per sec": "4.94",
|
|
142
|
+
"sample deviation": "0.01"
|
|
137
143
|
},
|
|
138
144
|
{
|
|
139
145
|
"test name": "Native JS Set 1,000,000 add",
|
|
140
|
-
"time taken (ms)": "
|
|
141
|
-
"executions per sec": "5.
|
|
146
|
+
"time taken (ms)": "167.46",
|
|
147
|
+
"executions per sec": "5.97",
|
|
142
148
|
"sample deviation": "0.01"
|
|
143
149
|
},
|
|
144
150
|
{
|
|
145
151
|
"test name": "1,000,000 set & get",
|
|
146
|
-
"time taken (ms)": "
|
|
147
|
-
"executions per sec": "8.
|
|
148
|
-
"sample deviation": "0.
|
|
152
|
+
"time taken (ms)": "115.60",
|
|
153
|
+
"executions per sec": "8.65",
|
|
154
|
+
"sample deviation": "0.01"
|
|
149
155
|
},
|
|
150
156
|
{
|
|
151
157
|
"test name": "Native JS Map 1,000,000 set & get",
|
|
152
|
-
"time taken (ms)": "
|
|
153
|
-
"executions per sec": "3.
|
|
158
|
+
"time taken (ms)": "265.34",
|
|
159
|
+
"executions per sec": "3.77",
|
|
154
160
|
"sample deviation": "0.01"
|
|
155
161
|
},
|
|
156
162
|
{
|
|
157
163
|
"test name": "Native JS Set 1,000,000 add & has",
|
|
158
|
-
"time taken (ms)": "
|
|
159
|
-
"executions per sec": "5.
|
|
164
|
+
"time taken (ms)": "167.85",
|
|
165
|
+
"executions per sec": "5.96",
|
|
160
166
|
"sample deviation": "0.01"
|
|
161
167
|
},
|
|
162
168
|
{
|
|
163
169
|
"test name": "1,000,000 ObjKey set & get",
|
|
164
|
-
"time taken (ms)": "
|
|
165
|
-
"executions per sec": "3.
|
|
166
|
-
"sample deviation": "0.
|
|
170
|
+
"time taken (ms)": "308.73",
|
|
171
|
+
"executions per sec": "3.24",
|
|
172
|
+
"sample deviation": "0.03"
|
|
167
173
|
},
|
|
168
174
|
{
|
|
169
175
|
"test name": "Native JS Map 1,000,000 ObjKey set & get",
|
|
170
|
-
"time taken (ms)": "
|
|
171
|
-
"executions per sec": "3.
|
|
172
|
-
"sample deviation": "0.
|
|
176
|
+
"time taken (ms)": "300.60",
|
|
177
|
+
"executions per sec": "3.33",
|
|
178
|
+
"sample deviation": "0.03"
|
|
173
179
|
},
|
|
174
180
|
{
|
|
175
181
|
"test name": "Native JS Set 1,000,000 ObjKey add & has",
|
|
176
|
-
"time taken (ms)": "
|
|
177
|
-
"executions per sec": "3.
|
|
178
|
-
"sample deviation": "0.
|
|
182
|
+
"time taken (ms)": "270.49",
|
|
183
|
+
"executions per sec": "3.70",
|
|
184
|
+
"sample deviation": "0.04"
|
|
179
185
|
}
|
|
180
186
|
],
|
|
181
187
|
"testName": "hash-map"
|
|
@@ -184,15 +190,15 @@
|
|
|
184
190
|
"benchmarks": [
|
|
185
191
|
{
|
|
186
192
|
"test name": "100,000 push",
|
|
187
|
-
"time taken (ms)": "
|
|
188
|
-
"executions per sec": "
|
|
189
|
-
"sample deviation": "
|
|
193
|
+
"time taken (ms)": "45.79",
|
|
194
|
+
"executions per sec": "21.84",
|
|
195
|
+
"sample deviation": "7.32e-4"
|
|
190
196
|
},
|
|
191
197
|
{
|
|
192
198
|
"test name": "100,000 getWords",
|
|
193
|
-
"time taken (ms)": "
|
|
194
|
-
"executions per sec": "11.
|
|
195
|
-
"sample deviation": "0.
|
|
199
|
+
"time taken (ms)": "87.85",
|
|
200
|
+
"executions per sec": "11.38",
|
|
201
|
+
"sample deviation": "0.00"
|
|
196
202
|
}
|
|
197
203
|
],
|
|
198
204
|
"testName": "trie"
|
|
@@ -201,32 +207,38 @@
|
|
|
201
207
|
"benchmarks": [
|
|
202
208
|
{
|
|
203
209
|
"test name": "100,000 add",
|
|
204
|
-
"time taken (ms)": "
|
|
205
|
-
"executions per sec": "
|
|
210
|
+
"time taken (ms)": "260.78",
|
|
211
|
+
"executions per sec": "3.83",
|
|
212
|
+
"sample deviation": "0.00"
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
"test name": "100,000 add randomly",
|
|
216
|
+
"time taken (ms)": "306.61",
|
|
217
|
+
"executions per sec": "3.26",
|
|
206
218
|
"sample deviation": "0.00"
|
|
207
219
|
},
|
|
208
220
|
{
|
|
209
221
|
"test name": "100,000 get",
|
|
210
|
-
"time taken (ms)": "
|
|
211
|
-
"executions per sec": "
|
|
222
|
+
"time taken (ms)": "140.27",
|
|
223
|
+
"executions per sec": "7.13",
|
|
212
224
|
"sample deviation": "0.00"
|
|
213
225
|
},
|
|
214
226
|
{
|
|
215
227
|
"test name": "100,000 iterator",
|
|
216
|
-
"time taken (ms)": "29.
|
|
217
|
-
"executions per sec": "33.
|
|
228
|
+
"time taken (ms)": "29.90",
|
|
229
|
+
"executions per sec": "33.45",
|
|
218
230
|
"sample deviation": "0.01"
|
|
219
231
|
},
|
|
220
232
|
{
|
|
221
233
|
"test name": "100,000 add & delete orderly",
|
|
222
|
-
"time taken (ms)": "
|
|
223
|
-
"executions per sec": "
|
|
234
|
+
"time taken (ms)": "428.76",
|
|
235
|
+
"executions per sec": "2.33",
|
|
224
236
|
"sample deviation": "0.00"
|
|
225
237
|
},
|
|
226
238
|
{
|
|
227
239
|
"test name": "100,000 add & delete randomly",
|
|
228
|
-
"time taken (ms)": "
|
|
229
|
-
"executions per sec": "1.
|
|
240
|
+
"time taken (ms)": "580.74",
|
|
241
|
+
"executions per sec": "1.72",
|
|
230
242
|
"sample deviation": "0.00"
|
|
231
243
|
}
|
|
232
244
|
],
|
|
@@ -236,39 +248,39 @@
|
|
|
236
248
|
"benchmarks": [
|
|
237
249
|
{
|
|
238
250
|
"test name": "10,000 RBTree add",
|
|
239
|
-
"time taken (ms)": "5.
|
|
240
|
-
"executions per sec": "
|
|
241
|
-
"sample deviation": "
|
|
251
|
+
"time taken (ms)": "5.74",
|
|
252
|
+
"executions per sec": "174.10",
|
|
253
|
+
"sample deviation": "9.29e-5"
|
|
242
254
|
},
|
|
243
255
|
{
|
|
244
256
|
"test name": "10,000 RBTree add & delete randomly",
|
|
245
|
-
"time taken (ms)": "
|
|
246
|
-
"executions per sec": "
|
|
247
|
-
"sample deviation": "1.
|
|
257
|
+
"time taken (ms)": "18.83",
|
|
258
|
+
"executions per sec": "53.10",
|
|
259
|
+
"sample deviation": "1.49e-4"
|
|
248
260
|
},
|
|
249
261
|
{
|
|
250
262
|
"test name": "10,000 RBTree get",
|
|
251
|
-
"time taken (ms)": "0.
|
|
252
|
-
"executions per sec": "
|
|
253
|
-
"sample deviation": "
|
|
263
|
+
"time taken (ms)": "0.77",
|
|
264
|
+
"executions per sec": "1290.55",
|
|
265
|
+
"sample deviation": "7.33e-6"
|
|
254
266
|
},
|
|
255
267
|
{
|
|
256
268
|
"test name": "10,000 AVLTree add",
|
|
257
|
-
"time taken (ms)": "
|
|
258
|
-
"executions per sec": "
|
|
259
|
-
"sample deviation": "
|
|
269
|
+
"time taken (ms)": "22.60",
|
|
270
|
+
"executions per sec": "44.25",
|
|
271
|
+
"sample deviation": "2.14e-4"
|
|
260
272
|
},
|
|
261
273
|
{
|
|
262
274
|
"test name": "10,000 AVLTree get",
|
|
263
|
-
"time taken (ms)": "
|
|
264
|
-
"executions per sec": "
|
|
265
|
-
"sample deviation": "
|
|
275
|
+
"time taken (ms)": "10.63",
|
|
276
|
+
"executions per sec": "94.08",
|
|
277
|
+
"sample deviation": "1.02e-4"
|
|
266
278
|
},
|
|
267
279
|
{
|
|
268
280
|
"test name": "10,000 AVLTree add & delete randomly",
|
|
269
|
-
"time taken (ms)": "
|
|
270
|
-
"executions per sec": "
|
|
271
|
-
"sample deviation": "
|
|
281
|
+
"time taken (ms)": "44.17",
|
|
282
|
+
"executions per sec": "22.64",
|
|
283
|
+
"sample deviation": "3.52e-4"
|
|
272
284
|
}
|
|
273
285
|
],
|
|
274
286
|
"testName": "binary-tree-overall"
|
|
@@ -277,39 +289,39 @@
|
|
|
277
289
|
"benchmarks": [
|
|
278
290
|
{
|
|
279
291
|
"test name": "1,000 addVertex",
|
|
280
|
-
"time taken (ms)": "0.
|
|
281
|
-
"executions per sec": "
|
|
282
|
-
"sample deviation": "
|
|
292
|
+
"time taken (ms)": "0.11",
|
|
293
|
+
"executions per sec": "9501.69",
|
|
294
|
+
"sample deviation": "1.02e-6"
|
|
283
295
|
},
|
|
284
296
|
{
|
|
285
297
|
"test name": "1,000 addEdge",
|
|
286
|
-
"time taken (ms)": "6.
|
|
287
|
-
"executions per sec": "
|
|
288
|
-
"sample deviation": "
|
|
298
|
+
"time taken (ms)": "6.18",
|
|
299
|
+
"executions per sec": "161.81",
|
|
300
|
+
"sample deviation": "4.27e-4"
|
|
289
301
|
},
|
|
290
302
|
{
|
|
291
303
|
"test name": "1,000 getVertex",
|
|
292
304
|
"time taken (ms)": "0.05",
|
|
293
|
-
"executions per sec": "2.
|
|
294
|
-
"sample deviation": "
|
|
305
|
+
"executions per sec": "2.16e+4",
|
|
306
|
+
"sample deviation": "3.23e-7"
|
|
295
307
|
},
|
|
296
308
|
{
|
|
297
309
|
"test name": "1,000 getEdge",
|
|
298
|
-
"time taken (ms)": "23.
|
|
299
|
-
"executions per sec": "
|
|
310
|
+
"time taken (ms)": "23.31",
|
|
311
|
+
"executions per sec": "42.90",
|
|
300
312
|
"sample deviation": "0.00"
|
|
301
313
|
},
|
|
302
314
|
{
|
|
303
315
|
"test name": "tarjan",
|
|
304
|
-
"time taken (ms)": "
|
|
305
|
-
"executions per sec": "4.
|
|
316
|
+
"time taken (ms)": "206.06",
|
|
317
|
+
"executions per sec": "4.85",
|
|
306
318
|
"sample deviation": "0.01"
|
|
307
319
|
},
|
|
308
320
|
{
|
|
309
321
|
"test name": "topologicalSort",
|
|
310
|
-
"time taken (ms)": "181.
|
|
311
|
-
"executions per sec": "5.
|
|
312
|
-
"sample deviation": "0.
|
|
322
|
+
"time taken (ms)": "181.65",
|
|
323
|
+
"executions per sec": "5.51",
|
|
324
|
+
"sample deviation": "0.01"
|
|
313
325
|
}
|
|
314
326
|
],
|
|
315
327
|
"testName": "directed-graph"
|
|
@@ -318,27 +330,27 @@
|
|
|
318
330
|
"benchmarks": [
|
|
319
331
|
{
|
|
320
332
|
"test name": "1,000,000 push",
|
|
321
|
-
"time taken (ms)": "
|
|
322
|
-
"executions per sec": "4.
|
|
323
|
-
"sample deviation": "0.
|
|
333
|
+
"time taken (ms)": "207.88",
|
|
334
|
+
"executions per sec": "4.81",
|
|
335
|
+
"sample deviation": "0.04"
|
|
324
336
|
},
|
|
325
337
|
{
|
|
326
338
|
"test name": "1,000,000 unshift",
|
|
327
|
-
"time taken (ms)": "
|
|
328
|
-
"executions per sec": "4.
|
|
329
|
-
"sample deviation": "0.
|
|
339
|
+
"time taken (ms)": "214.33",
|
|
340
|
+
"executions per sec": "4.67",
|
|
341
|
+
"sample deviation": "0.06"
|
|
330
342
|
},
|
|
331
343
|
{
|
|
332
344
|
"test name": "1,000,000 unshift & shift",
|
|
333
|
-
"time taken (ms)": "
|
|
334
|
-
"executions per sec": "
|
|
335
|
-
"sample deviation": "0.
|
|
345
|
+
"time taken (ms)": "185.54",
|
|
346
|
+
"executions per sec": "5.39",
|
|
347
|
+
"sample deviation": "0.04"
|
|
336
348
|
},
|
|
337
349
|
{
|
|
338
350
|
"test name": "1,000,000 addBefore",
|
|
339
|
-
"time taken (ms)": "
|
|
340
|
-
"executions per sec": "3.
|
|
341
|
-
"sample deviation": "0.
|
|
351
|
+
"time taken (ms)": "308.66",
|
|
352
|
+
"executions per sec": "3.24",
|
|
353
|
+
"sample deviation": "0.08"
|
|
342
354
|
}
|
|
343
355
|
],
|
|
344
356
|
"testName": "doubly-linked-list"
|
|
@@ -347,20 +359,20 @@
|
|
|
347
359
|
"benchmarks": [
|
|
348
360
|
{
|
|
349
361
|
"test name": "1,000,000 push & shift",
|
|
350
|
-
"time taken (ms)": "
|
|
351
|
-
"executions per sec": "
|
|
352
|
-
"sample deviation": "0.
|
|
362
|
+
"time taken (ms)": "202.61",
|
|
363
|
+
"executions per sec": "4.94",
|
|
364
|
+
"sample deviation": "0.04"
|
|
353
365
|
},
|
|
354
366
|
{
|
|
355
367
|
"test name": "10,000 push & pop",
|
|
356
|
-
"time taken (ms)": "
|
|
357
|
-
"executions per sec": "4.
|
|
358
|
-
"sample deviation": "0.
|
|
368
|
+
"time taken (ms)": "219.69",
|
|
369
|
+
"executions per sec": "4.55",
|
|
370
|
+
"sample deviation": "0.02"
|
|
359
371
|
},
|
|
360
372
|
{
|
|
361
373
|
"test name": "10,000 addBefore",
|
|
362
|
-
"time taken (ms)": "
|
|
363
|
-
"executions per sec": "4.
|
|
374
|
+
"time taken (ms)": "247.13",
|
|
375
|
+
"executions per sec": "4.05",
|
|
364
376
|
"sample deviation": "0.01"
|
|
365
377
|
}
|
|
366
378
|
],
|
|
@@ -370,15 +382,15 @@
|
|
|
370
382
|
"benchmarks": [
|
|
371
383
|
{
|
|
372
384
|
"test name": "100,000 add",
|
|
373
|
-
"time taken (ms)": "27.
|
|
374
|
-
"executions per sec": "36.
|
|
375
|
-
"sample deviation": "
|
|
385
|
+
"time taken (ms)": "27.36",
|
|
386
|
+
"executions per sec": "36.55",
|
|
387
|
+
"sample deviation": "9.92e-4"
|
|
376
388
|
},
|
|
377
389
|
{
|
|
378
390
|
"test name": "100,000 add & poll",
|
|
379
|
-
"time taken (ms)": "
|
|
380
|
-
"executions per sec": "
|
|
381
|
-
"sample deviation": "
|
|
391
|
+
"time taken (ms)": "146.72",
|
|
392
|
+
"executions per sec": "6.82",
|
|
393
|
+
"sample deviation": "6.84e-4"
|
|
382
394
|
}
|
|
383
395
|
],
|
|
384
396
|
"testName": "priority-queue"
|
|
@@ -387,14 +399,14 @@
|
|
|
387
399
|
"benchmarks": [
|
|
388
400
|
{
|
|
389
401
|
"test name": "1,000,000 push",
|
|
390
|
-
"time taken (ms)": "39.
|
|
391
|
-
"executions per sec": "25.
|
|
402
|
+
"time taken (ms)": "39.36",
|
|
403
|
+
"executions per sec": "25.41",
|
|
392
404
|
"sample deviation": "0.01"
|
|
393
405
|
},
|
|
394
406
|
{
|
|
395
407
|
"test name": "1,000,000 push & pop",
|
|
396
|
-
"time taken (ms)": "
|
|
397
|
-
"executions per sec": "
|
|
408
|
+
"time taken (ms)": "47.86",
|
|
409
|
+
"executions per sec": "20.89",
|
|
398
410
|
"sample deviation": "0.01"
|
|
399
411
|
}
|
|
400
412
|
],
|
|
@@ -97,6 +97,12 @@ export declare class BinaryTree<K = any, V = any, NODE extends BinaryTreeNode<K,
|
|
|
97
97
|
* @returns The size of the object, which is a number.
|
|
98
98
|
*/
|
|
99
99
|
get size(): number;
|
|
100
|
+
protected _NIL: NODE;
|
|
101
|
+
/**
|
|
102
|
+
* The function returns the value of the _NIL property.
|
|
103
|
+
* @returns The method is returning the value of the `_NIL` property.
|
|
104
|
+
*/
|
|
105
|
+
get NIL(): NODE;
|
|
100
106
|
/**
|
|
101
107
|
* Creates a new instance of BinaryTreeNode with the given key and value.
|
|
102
108
|
* @param {K} key - The key for the new node.
|
|
@@ -140,19 +146,18 @@ export declare class BinaryTree<K = any, V = any, NODE extends BinaryTreeNode<K,
|
|
|
140
146
|
* itself if it is not a valid node key.
|
|
141
147
|
*/
|
|
142
148
|
ensureNode(keyOrNodeOrEntry: KeyOrNodeOrEntry<K, V, NODE>, iterationType?: IterationType): NODE | null | undefined;
|
|
149
|
+
/**
|
|
150
|
+
* The function checks if a given node is a real node or null.
|
|
151
|
+
* @param {any} node - The parameter `node` is of type `any`, which means it can be any data type.
|
|
152
|
+
* @returns a boolean value.
|
|
153
|
+
*/
|
|
154
|
+
isNodeOrNull(node: KeyOrNodeOrEntry<K, V, NODE>): node is NODE | null;
|
|
143
155
|
/**
|
|
144
156
|
* The function "isNode" checks if an keyOrNodeOrEntry is an instance of the BinaryTreeNode class.
|
|
145
157
|
* @param keyOrNodeOrEntry - The `keyOrNodeOrEntry` parameter is a variable of type `KeyOrNodeOrEntry<K, V,NODE>`.
|
|
146
158
|
* @returns a boolean value indicating whether the keyOrNodeOrEntry is an instance of the class NODE.
|
|
147
159
|
*/
|
|
148
160
|
isNode(keyOrNodeOrEntry: KeyOrNodeOrEntry<K, V, NODE>): keyOrNodeOrEntry is NODE;
|
|
149
|
-
/**
|
|
150
|
-
* The function checks if a given value is an entry in a binary tree node.
|
|
151
|
-
* @param keyOrNodeOrEntry - KeyOrNodeOrEntry<K, V,NODE> - A generic type representing a node in a binary tree. It has
|
|
152
|
-
* two type parameters V and NODE, representing the value and node type respectively.
|
|
153
|
-
* @returns a boolean value.
|
|
154
|
-
*/
|
|
155
|
-
isEntry(keyOrNodeOrEntry: KeyOrNodeOrEntry<K, V, NODE>): keyOrNodeOrEntry is BTNEntry<K, V>;
|
|
156
161
|
/**
|
|
157
162
|
* The function checks if a given node is a real node by verifying if it is an instance of
|
|
158
163
|
* BinaryTreeNode and its key is not NaN.
|
|
@@ -167,11 +172,12 @@ export declare class BinaryTree<K = any, V = any, NODE extends BinaryTreeNode<K,
|
|
|
167
172
|
*/
|
|
168
173
|
isNIL(node: KeyOrNodeOrEntry<K, V, NODE>): boolean;
|
|
169
174
|
/**
|
|
170
|
-
* The function checks if a given
|
|
171
|
-
* @param
|
|
175
|
+
* The function checks if a given value is an entry in a binary tree node.
|
|
176
|
+
* @param keyOrNodeOrEntry - KeyOrNodeOrEntry<K, V,NODE> - A generic type representing a node in a binary tree. It has
|
|
177
|
+
* two type parameters V and NODE, representing the value and node type respectively.
|
|
172
178
|
* @returns a boolean value.
|
|
173
179
|
*/
|
|
174
|
-
|
|
180
|
+
isEntry(keyOrNodeOrEntry: KeyOrNodeOrEntry<K, V, NODE>): keyOrNodeOrEntry is BTNEntry<K, V>;
|
|
175
181
|
/**
|
|
176
182
|
* Time Complexity O(n)
|
|
177
183
|
* Space Complexity O(1)
|