data-structure-typed 1.41.8 → 1.42.0

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.
@@ -3,27 +3,27 @@
3
3
  "benchmarks": [
4
4
  {
5
5
  "test name": "10,000 add randomly",
6
- "time taken (ms)": "30.29",
7
- "executions per sec": "33.01",
8
- "sample deviation": "3.64e-4"
6
+ "time taken (ms)": "34.10",
7
+ "executions per sec": "29.32",
8
+ "sample deviation": "0.00"
9
9
  },
10
10
  {
11
11
  "test name": "10,000 add & delete randomly",
12
- "time taken (ms)": "68.10",
13
- "executions per sec": "14.68",
12
+ "time taken (ms)": "74.44",
13
+ "executions per sec": "13.43",
14
14
  "sample deviation": "0.00"
15
15
  },
16
16
  {
17
17
  "test name": "10,000 addMany",
18
- "time taken (ms)": "39.54",
19
- "executions per sec": "25.29",
20
- "sample deviation": "4.07e-4"
18
+ "time taken (ms)": "44.65",
19
+ "executions per sec": "22.39",
20
+ "sample deviation": "0.00"
21
21
  },
22
22
  {
23
23
  "test name": "10,000 get",
24
- "time taken (ms)": "26.72",
25
- "executions per sec": "37.42",
26
- "sample deviation": "3.77e-4"
24
+ "time taken (ms)": "30.76",
25
+ "executions per sec": "32.51",
26
+ "sample deviation": "0.00"
27
27
  }
28
28
  ],
29
29
  "testName": "avl-tree"
@@ -32,45 +32,45 @@
32
32
  "benchmarks": [
33
33
  {
34
34
  "test name": "1,000 add randomly",
35
- "time taken (ms)": "12.88",
36
- "executions per sec": "77.63",
37
- "sample deviation": "1.02e-4"
35
+ "time taken (ms)": "13.23",
36
+ "executions per sec": "75.58",
37
+ "sample deviation": "2.94e-4"
38
38
  },
39
39
  {
40
40
  "test name": "1,000 add & delete randomly",
41
- "time taken (ms)": "15.90",
42
- "executions per sec": "62.88",
43
- "sample deviation": "1.08e-4"
41
+ "time taken (ms)": "16.29",
42
+ "executions per sec": "61.38",
43
+ "sample deviation": "7.50e-4"
44
44
  },
45
45
  {
46
46
  "test name": "1,000 addMany",
47
- "time taken (ms)": "10.59",
48
- "executions per sec": "94.41",
49
- "sample deviation": "8.39e-5"
47
+ "time taken (ms)": "10.58",
48
+ "executions per sec": "94.51",
49
+ "sample deviation": "1.17e-4"
50
50
  },
51
51
  {
52
52
  "test name": "1,000 get",
53
- "time taken (ms)": "18.01",
54
- "executions per sec": "55.53",
55
- "sample deviation": "1.95e-4"
53
+ "time taken (ms)": "18.09",
54
+ "executions per sec": "55.28",
55
+ "sample deviation": "3.74e-4"
56
56
  },
57
57
  {
58
58
  "test name": "1,000 dfs",
59
- "time taken (ms)": "69.11",
60
- "executions per sec": "14.47",
61
- "sample deviation": "6.47e-4"
59
+ "time taken (ms)": "71.97",
60
+ "executions per sec": "13.89",
61
+ "sample deviation": "0.00"
62
62
  },
63
63
  {
64
64
  "test name": "1,000 bfs",
65
- "time taken (ms)": "54.42",
66
- "executions per sec": "18.38",
67
- "sample deviation": "4.20e-4"
65
+ "time taken (ms)": "57.49",
66
+ "executions per sec": "17.39",
67
+ "sample deviation": "5.01e-4"
68
68
  },
69
69
  {
70
70
  "test name": "1,000 morris",
71
- "time taken (ms)": "37.14",
72
- "executions per sec": "26.92",
73
- "sample deviation": "2.27e-4"
71
+ "time taken (ms)": "37.35",
72
+ "executions per sec": "26.78",
73
+ "sample deviation": "2.94e-4"
74
74
  }
75
75
  ],
76
76
  "testName": "binary-tree"
@@ -79,27 +79,27 @@
79
79
  "benchmarks": [
80
80
  {
81
81
  "test name": "10,000 add randomly",
82
- "time taken (ms)": "28.48",
83
- "executions per sec": "35.11",
84
- "sample deviation": "2.29e-4"
82
+ "time taken (ms)": "33.54",
83
+ "executions per sec": "29.81",
84
+ "sample deviation": "3.61e-4"
85
85
  },
86
86
  {
87
87
  "test name": "10,000 add & delete randomly",
88
- "time taken (ms)": "64.82",
89
- "executions per sec": "15.43",
90
- "sample deviation": "0.01"
88
+ "time taken (ms)": "75.05",
89
+ "executions per sec": "13.33",
90
+ "sample deviation": "0.00"
91
91
  },
92
92
  {
93
93
  "test name": "10,000 addMany",
94
- "time taken (ms)": "28.74",
95
- "executions per sec": "34.80",
96
- "sample deviation": "9.06e-4"
94
+ "time taken (ms)": "31.50",
95
+ "executions per sec": "31.74",
96
+ "sample deviation": "4.90e-4"
97
97
  },
98
98
  {
99
99
  "test name": "10,000 get",
100
- "time taken (ms)": "27.38",
101
- "executions per sec": "36.52",
102
- "sample deviation": "1.82e-4"
100
+ "time taken (ms)": "34.92",
101
+ "executions per sec": "28.64",
102
+ "sample deviation": "0.01"
103
103
  }
104
104
  ],
105
105
  "testName": "bst"
@@ -108,21 +108,21 @@
108
108
  "benchmarks": [
109
109
  {
110
110
  "test name": "100,000 add randomly",
111
- "time taken (ms)": "72.30",
112
- "executions per sec": "13.83",
113
- "sample deviation": "0.00"
111
+ "time taken (ms)": "80.61",
112
+ "executions per sec": "12.41",
113
+ "sample deviation": "0.01"
114
114
  },
115
115
  {
116
116
  "test name": "100,000 add & 1000 delete randomly",
117
- "time taken (ms)": "81.37",
118
- "executions per sec": "12.29",
117
+ "time taken (ms)": "86.72",
118
+ "executions per sec": "11.53",
119
119
  "sample deviation": "0.01"
120
120
  },
121
121
  {
122
122
  "test name": "100,000 getNode",
123
- "time taken (ms)": "59.48",
124
- "executions per sec": "16.81",
125
- "sample deviation": "9.29e-4"
123
+ "time taken (ms)": "75.09",
124
+ "executions per sec": "13.32",
125
+ "sample deviation": "0.03"
126
126
  }
127
127
  ],
128
128
  "testName": "rb-tree"
@@ -131,45 +131,45 @@
131
131
  "benchmarks": [
132
132
  {
133
133
  "test name": "1,000 addVertex",
134
- "time taken (ms)": "0.10",
135
- "executions per sec": "9786.77",
136
- "sample deviation": "5.56e-7"
134
+ "time taken (ms)": "0.12",
135
+ "executions per sec": "8506.54",
136
+ "sample deviation": "3.38e-5"
137
137
  },
138
138
  {
139
139
  "test name": "1,000 addEdge",
140
- "time taken (ms)": "6.02",
141
- "executions per sec": "166.04",
142
- "sample deviation": "1.27e-4"
140
+ "time taken (ms)": "6.96",
141
+ "executions per sec": "143.61",
142
+ "sample deviation": "0.00"
143
143
  },
144
144
  {
145
145
  "test name": "1,000 getVertex",
146
146
  "time taken (ms)": "0.05",
147
- "executions per sec": "2.18e+4",
148
- "sample deviation": "3.02e-7"
147
+ "executions per sec": "1.85e+4",
148
+ "sample deviation": "2.60e-5"
149
149
  },
150
150
  {
151
151
  "test name": "1,000 getEdge",
152
- "time taken (ms)": "23.41",
153
- "executions per sec": "42.71",
154
- "sample deviation": "0.00"
152
+ "time taken (ms)": "23.99",
153
+ "executions per sec": "41.69",
154
+ "sample deviation": "0.01"
155
155
  },
156
156
  {
157
157
  "test name": "tarjan",
158
- "time taken (ms)": "223.51",
159
- "executions per sec": "4.47",
160
- "sample deviation": "0.01"
158
+ "time taken (ms)": "205.07",
159
+ "executions per sec": "4.88",
160
+ "sample deviation": "0.04"
161
161
  },
162
162
  {
163
163
  "test name": "tarjan all",
164
- "time taken (ms)": "224.89",
165
- "executions per sec": "4.45",
166
- "sample deviation": "0.00"
164
+ "time taken (ms)": "211.45",
165
+ "executions per sec": "4.73",
166
+ "sample deviation": "0.04"
167
167
  },
168
168
  {
169
169
  "test name": "topologicalSort",
170
- "time taken (ms)": "181.90",
171
- "executions per sec": "5.50",
172
- "sample deviation": "0.00"
170
+ "time taken (ms)": "186.95",
171
+ "executions per sec": "5.35",
172
+ "sample deviation": "0.06"
173
173
  }
174
174
  ],
175
175
  "testName": "directed-graph"
@@ -178,15 +178,15 @@
178
178
  "benchmarks": [
179
179
  {
180
180
  "test name": "10,000 add & pop",
181
- "time taken (ms)": "4.62",
182
- "executions per sec": "216.33",
183
- "sample deviation": "3.06e-5"
181
+ "time taken (ms)": "5.03",
182
+ "executions per sec": "198.77",
183
+ "sample deviation": "0.00"
184
184
  },
185
185
  {
186
186
  "test name": "10,000 fib add & pop",
187
- "time taken (ms)": "351.41",
188
- "executions per sec": "2.85",
189
- "sample deviation": "0.00"
187
+ "time taken (ms)": "373.81",
188
+ "executions per sec": "2.68",
189
+ "sample deviation": "0.03"
190
190
  }
191
191
  ],
192
192
  "testName": "heap"
@@ -195,21 +195,21 @@
195
195
  "benchmarks": [
196
196
  {
197
197
  "test name": "1,000,000 unshift",
198
- "time taken (ms)": "214.84",
199
- "executions per sec": "4.65",
200
- "sample deviation": "0.04"
198
+ "time taken (ms)": "231.55",
199
+ "executions per sec": "4.32",
200
+ "sample deviation": "0.03"
201
201
  },
202
202
  {
203
203
  "test name": "1,000,000 unshift & shift",
204
- "time taken (ms)": "167.11",
205
- "executions per sec": "5.98",
206
- "sample deviation": "0.04"
204
+ "time taken (ms)": "163.44",
205
+ "executions per sec": "6.12",
206
+ "sample deviation": "0.01"
207
207
  },
208
208
  {
209
209
  "test name": "1,000,000 insertBefore",
210
- "time taken (ms)": "335.78",
211
- "executions per sec": "2.98",
212
- "sample deviation": "0.07"
210
+ "time taken (ms)": "301.21",
211
+ "executions per sec": "3.32",
212
+ "sample deviation": "0.03"
213
213
  }
214
214
  ],
215
215
  "testName": "doubly-linked-list"
@@ -218,15 +218,15 @@
218
218
  "benchmarks": [
219
219
  {
220
220
  "test name": "10,000 push & pop",
221
- "time taken (ms)": "212.53",
222
- "executions per sec": "4.71",
221
+ "time taken (ms)": "216.27",
222
+ "executions per sec": "4.62",
223
223
  "sample deviation": "0.01"
224
224
  },
225
225
  {
226
226
  "test name": "10,000 insertBefore",
227
- "time taken (ms)": "243.94",
228
- "executions per sec": "4.10",
229
- "sample deviation": "0.00"
227
+ "time taken (ms)": "252.18",
228
+ "executions per sec": "3.97",
229
+ "sample deviation": "0.01"
230
230
  }
231
231
  ],
232
232
  "testName": "singly-linked-list"
@@ -235,9 +235,9 @@
235
235
  "benchmarks": [
236
236
  {
237
237
  "test name": "10,000 refill & poll",
238
- "time taken (ms)": "11.43",
239
- "executions per sec": "87.50",
240
- "sample deviation": "1.84e-4"
238
+ "time taken (ms)": "11.56",
239
+ "executions per sec": "86.52",
240
+ "sample deviation": "2.35e-4"
241
241
  }
242
242
  ],
243
243
  "testName": "max-priority-queue"
@@ -246,14 +246,14 @@
246
246
  "benchmarks": [
247
247
  {
248
248
  "test name": "1,000,000 push",
249
- "time taken (ms)": "216.07",
250
- "executions per sec": "4.63",
249
+ "time taken (ms)": "222.98",
250
+ "executions per sec": "4.48",
251
251
  "sample deviation": "0.05"
252
252
  },
253
253
  {
254
254
  "test name": "1,000,000 shift",
255
- "time taken (ms)": "24.97",
256
- "executions per sec": "40.05",
255
+ "time taken (ms)": "26.01",
256
+ "executions per sec": "38.44",
257
257
  "sample deviation": "0.00"
258
258
  }
259
259
  ],
@@ -263,15 +263,15 @@
263
263
  "benchmarks": [
264
264
  {
265
265
  "test name": "1,000,000 push",
266
- "time taken (ms)": "42.57",
267
- "executions per sec": "23.49",
266
+ "time taken (ms)": "44.93",
267
+ "executions per sec": "22.26",
268
268
  "sample deviation": "0.01"
269
269
  },
270
270
  {
271
271
  "test name": "1,000,000 push & shift",
272
- "time taken (ms)": "79.94",
273
- "executions per sec": "12.51",
274
- "sample deviation": "9.99e-4"
272
+ "time taken (ms)": "80.87",
273
+ "executions per sec": "12.37",
274
+ "sample deviation": "0.00"
275
275
  }
276
276
  ],
277
277
  "testName": "queue"
@@ -280,15 +280,15 @@
280
280
  "benchmarks": [
281
281
  {
282
282
  "test name": "100,000 push",
283
- "time taken (ms)": "54.02",
284
- "executions per sec": "18.51",
285
- "sample deviation": "0.00"
283
+ "time taken (ms)": "57.22",
284
+ "executions per sec": "17.48",
285
+ "sample deviation": "0.01"
286
286
  },
287
287
  {
288
288
  "test name": "100,000 getWords",
289
- "time taken (ms)": "82.83",
290
- "executions per sec": "12.07",
291
- "sample deviation": "0.00"
289
+ "time taken (ms)": "99.32",
290
+ "executions per sec": "10.07",
291
+ "sample deviation": "0.01"
292
292
  }
293
293
  ],
294
294
  "testName": "trie"
@@ -238,67 +238,18 @@ export declare class BinaryTree<V = any, N extends BinaryTreeNode<V, N> = Binary
238
238
  * @returns a boolean value.
239
239
  */
240
240
  isBST(iterationType?: IterationType): boolean;
241
- /**
242
- * The function `subTreeTraverse` traverses a binary tree and applies a callback function to each
243
- * node, either recursively or iteratively.
244
- * @param callback - The `callback` parameter is a function that will be called on each node in the
245
- * subtree traversal. It takes a single argument, which is the current node being traversed, and
246
- * returns a value. The return values from each callback invocation will be collected and returned as
247
- * an array.
248
- * @param {BTNKey | N | null} beginRoot - The `beginRoot` parameter is the starting point
249
- * for traversing the subtree. It can be either a node object, a key value of a node, or `null` to
250
- * start from the root of the tree.
251
- * @param iterationType - The `iterationType` parameter determines the type of traversal to be
252
- * performed on the binary tree. It can have two possible values:
253
- * @returns The function `subTreeTraverse` returns an array of `ReturnType<BTNCallback<N>>`.
254
- */
255
- subTreeTraverse<C extends BTNCallback<N>>(callback?: C, beginRoot?: BTNKey | N | null, iterationType?: IterationType): ReturnType<C>[];
256
- /**
257
- * The `dfs` function performs a depth-first search traversal on a binary tree, executing a callback
258
- * function on each node according to a specified order pattern.
259
- * @param callback - The `callback` parameter is a function that will be called on each node during
260
- * the depth-first search traversal. It takes a node as input and returns a value. The default value
261
- * is `this.defaultOneParamCallback`, which is a callback function defined elsewhere in the code.
262
- * @param {DFSOrderPattern} [pattern=in] - The `pattern` parameter determines the order in which the
263
- * nodes are visited during the depth-first search. There are three possible values for `pattern`:
264
- * @param {N | null} beginRoot - The `beginRoot` parameter is the starting node for the depth-first
265
- * search. It determines where the search will begin in the tree or graph structure. If `beginRoot`
266
- * is `null`, an empty array will be returned.
267
- * @param {IterationType} iterationType - The `iterationType` parameter determines the type of
268
- * iteration used in the depth-first search algorithm. It can have two possible values:
269
- * @returns The function `dfs` returns an array of `ReturnType<BTNCallback<N>>` values.
270
- */
271
- dfs<C extends BTNCallback<N>>(callback?: C, pattern?: DFSOrderPattern, beginRoot?: N | null, iterationType?: IterationType): ReturnType<C>[];
272
- /**
273
- * The bfs function performs a breadth-first search traversal on a binary tree, executing a callback
274
- * function on each node.
275
- * @param callback - The `callback` parameter is a function that will be called for each node in the
276
- * breadth-first search. It takes a node of type `N` as its argument and returns a value of type
277
- * `ReturnType<BTNCallback<N>>`. The default value for this parameter is `this.defaultOneParamCallback
278
- * @param {N | null} beginRoot - The `beginRoot` parameter is the starting node for the breadth-first
279
- * search. It determines from which node the search will begin. If `beginRoot` is `null`, the search
280
- * will not be performed and an empty array will be returned.
281
- * @param iterationType - The `iterationType` parameter determines the type of iteration to be used
282
- * in the breadth-first search (BFS) algorithm. It can have two possible values:
283
- * @returns The function `bfs` returns an array of `ReturnType<BTNCallback<N>>[]`.
284
- */
285
- bfs<C extends BTNCallback<N>>(callback?: C, beginRoot?: N | null, iterationType?: IterationType): ReturnType<C>[];
286
- /**
287
- * The `listLevels` function takes a binary tree node and a callback function, and returns an array
288
- * of arrays representing the levels of the tree.
289
- * @param {C} callback - The `callback` parameter is a function that will be called on each node in
290
- * the tree. It takes a node as input and returns a value. The return type of the callback function
291
- * is determined by the generic type `C`.
292
- * @param {N | null} beginRoot - The `beginRoot` parameter represents the starting node of the binary tree
293
- * traversal. It can be any node in the binary tree. If no node is provided, the traversal will start
294
- * from the root node of the binary tree.
295
- * @param iterationType - The `iterationType` parameter determines whether the tree traversal is done
296
- * recursively or iteratively. It can have two possible values:
297
- * @returns The function `listLevels` returns an array of arrays, where each inner array represents a
298
- * level in a binary tree. Each inner array contains the return type of the provided callback
299
- * function `C` applied to the nodes at that level.
300
- */
301
- listLevels<C extends BTNCallback<N>>(callback?: C, beginRoot?: N | null, iterationType?: IterationType): ReturnType<C>[][];
241
+ subTreeTraverse<C extends BTNCallback<N>>(callback?: C, beginRoot?: BTNKey | N | null, iterationType?: IterationType, includeNull?: false): ReturnType<C>[];
242
+ subTreeTraverse<C extends BTNCallback<N>>(callback?: C, beginRoot?: BTNKey | N | null, iterationType?: IterationType, includeNull?: undefined): ReturnType<C>[];
243
+ subTreeTraverse<C extends BTNCallback<N | null>>(callback?: C, beginRoot?: BTNKey | N | null, iterationType?: IterationType, includeNull?: true): ReturnType<C>[];
244
+ dfs<C extends BTNCallback<N>>(callback?: C, pattern?: DFSOrderPattern, beginRoot?: N | null, iterationType?: IterationType, includeNull?: false): ReturnType<C>[];
245
+ dfs<C extends BTNCallback<N>>(callback?: C, pattern?: DFSOrderPattern, beginRoot?: N | null, iterationType?: IterationType, includeNull?: undefined): ReturnType<C>[];
246
+ dfs<C extends BTNCallback<N | null>>(callback?: C, pattern?: DFSOrderPattern, beginRoot?: N | null, iterationType?: IterationType, includeNull?: true): ReturnType<C>[];
247
+ bfs<C extends BTNCallback<N>>(callback?: C, beginRoot?: N | null, iterationType?: IterationType, includeNull?: false): ReturnType<C>[];
248
+ bfs<C extends BTNCallback<N>>(callback?: C, beginRoot?: N | null, iterationType?: IterationType, includeNull?: undefined): ReturnType<C>[];
249
+ bfs<C extends BTNCallback<N | null>>(callback?: C, beginRoot?: N | null, iterationType?: IterationType, includeNull?: true): ReturnType<C>[];
250
+ listLevels<C extends BTNCallback<N>>(callback?: C, beginRoot?: N | null, iterationType?: IterationType, includeNull?: false): ReturnType<C>[][];
251
+ listLevels<C extends BTNCallback<N>>(callback?: C, beginRoot?: N | null, iterationType?: IterationType, includeNull?: undefined): ReturnType<C>[][];
252
+ listLevels<C extends BTNCallback<N | null>>(callback?: C, beginRoot?: N | null, iterationType?: IterationType, includeNull?: true): ReturnType<C>[][];
302
253
  /**
303
254
  * The function returns the predecessor node of a given node in a binary tree.
304
255
  * @param {N} node - The parameter "node" represents a node in a binary tree.