bst-typed 2.5.2 → 2.5.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.
Files changed (59) hide show
  1. package/dist/cjs/index.cjs +241 -59
  2. package/dist/cjs/index.cjs.map +1 -1
  3. package/dist/cjs-legacy/index.cjs +241 -59
  4. package/dist/cjs-legacy/index.cjs.map +1 -1
  5. package/dist/esm/index.mjs +241 -59
  6. package/dist/esm/index.mjs.map +1 -1
  7. package/dist/esm-legacy/index.mjs +241 -59
  8. package/dist/esm-legacy/index.mjs.map +1 -1
  9. package/dist/types/data-structures/binary-tree/avl-tree.d.ts +50 -2
  10. package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +56 -0
  11. package/dist/types/data-structures/binary-tree/binary-tree.d.ts +116 -15
  12. package/dist/types/data-structures/binary-tree/bst.d.ts +99 -3
  13. package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +79 -8
  14. package/dist/types/data-structures/binary-tree/segment-tree.d.ts +24 -0
  15. package/dist/types/data-structures/binary-tree/tree-map.d.ts +520 -1
  16. package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +489 -1
  17. package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +393 -1
  18. package/dist/types/data-structures/binary-tree/tree-set.d.ts +500 -1
  19. package/dist/types/data-structures/graph/directed-graph.d.ts +40 -0
  20. package/dist/types/data-structures/graph/undirected-graph.d.ts +36 -0
  21. package/dist/types/data-structures/hash/hash-map.d.ts +51 -6
  22. package/dist/types/data-structures/heap/heap.d.ts +98 -12
  23. package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +75 -0
  24. package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +61 -1
  25. package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +72 -0
  26. package/dist/types/data-structures/matrix/matrix.d.ts +32 -0
  27. package/dist/types/data-structures/queue/deque.d.ts +82 -0
  28. package/dist/types/data-structures/queue/queue.d.ts +61 -0
  29. package/dist/types/data-structures/stack/stack.d.ts +42 -2
  30. package/dist/types/data-structures/trie/trie.d.ts +48 -0
  31. package/dist/types/interfaces/binary-tree.d.ts +2 -3
  32. package/dist/umd/bst-typed.js +241 -59
  33. package/dist/umd/bst-typed.js.map +1 -1
  34. package/dist/umd/bst-typed.min.js +2 -2
  35. package/dist/umd/bst-typed.min.js.map +1 -1
  36. package/package.json +2 -2
  37. package/src/data-structures/binary-tree/avl-tree.ts +52 -5
  38. package/src/data-structures/binary-tree/binary-indexed-tree.ts +56 -0
  39. package/src/data-structures/binary-tree/binary-tree.ts +167 -81
  40. package/src/data-structures/binary-tree/bst.ts +101 -7
  41. package/src/data-structures/binary-tree/red-black-tree.ts +82 -15
  42. package/src/data-structures/binary-tree/segment-tree.ts +24 -0
  43. package/src/data-structures/binary-tree/tree-map.ts +540 -3
  44. package/src/data-structures/binary-tree/tree-multi-map.ts +490 -2
  45. package/src/data-structures/binary-tree/tree-multi-set.ts +393 -1
  46. package/src/data-structures/binary-tree/tree-set.ts +520 -3
  47. package/src/data-structures/graph/directed-graph.ts +41 -1
  48. package/src/data-structures/graph/undirected-graph.ts +37 -1
  49. package/src/data-structures/hash/hash-map.ts +67 -12
  50. package/src/data-structures/heap/heap.ts +107 -19
  51. package/src/data-structures/linked-list/doubly-linked-list.ts +88 -0
  52. package/src/data-structures/linked-list/singly-linked-list.ts +61 -1
  53. package/src/data-structures/linked-list/skip-linked-list.ts +72 -0
  54. package/src/data-structures/matrix/matrix.ts +32 -0
  55. package/src/data-structures/queue/deque.ts +85 -0
  56. package/src/data-structures/queue/queue.ts +73 -0
  57. package/src/data-structures/stack/stack.ts +45 -5
  58. package/src/data-structures/trie/trie.ts +48 -0
  59. package/src/interfaces/binary-tree.ts +1 -9
@@ -811,6 +811,10 @@ var bstTyped = (() => {
811
811
 
812
812
 
813
813
 
814
+
815
+
816
+
817
+
814
818
 
815
819
 
816
820
 
@@ -861,6 +865,10 @@ var bstTyped = (() => {
861
865
 
862
866
 
863
867
 
868
+
869
+
870
+
871
+
864
872
 
865
873
 
866
874
 
@@ -875,6 +883,14 @@ var bstTyped = (() => {
875
883
  get first() {
876
884
  return this.length > 0 ? this.elements[this._offset] : void 0;
877
885
  }
886
+ /**
887
+ * Peek at the front element without removing it (alias for `first`).
888
+ * @remarks Time O(1), Space O(1)
889
+ * @returns Front element or undefined.
890
+ */
891
+ peek() {
892
+ return this.first;
893
+ }
878
894
  /**
879
895
  * Get the last element (back) without removing it.
880
896
  * @remarks Time O(1), Space O(1)
@@ -927,6 +943,10 @@ var bstTyped = (() => {
927
943
 
928
944
 
929
945
 
946
+
947
+
948
+
949
+
930
950
 
931
951
 
932
952
 
@@ -989,6 +1009,10 @@ var bstTyped = (() => {
989
1009
 
990
1010
 
991
1011
 
1012
+
1013
+
1014
+
1015
+
992
1016
 
993
1017
 
994
1018
 
@@ -1058,6 +1082,10 @@ var bstTyped = (() => {
1058
1082
 
1059
1083
 
1060
1084
 
1085
+
1086
+
1087
+
1088
+
1061
1089
 
1062
1090
 
1063
1091
 
@@ -1117,6 +1145,10 @@ var bstTyped = (() => {
1117
1145
 
1118
1146
 
1119
1147
 
1148
+
1149
+
1150
+
1151
+
1120
1152
 
1121
1153
 
1122
1154
 
@@ -1169,6 +1201,10 @@ var bstTyped = (() => {
1169
1201
 
1170
1202
 
1171
1203
 
1204
+
1205
+
1206
+
1207
+
1172
1208
 
1173
1209
 
1174
1210
 
@@ -1220,6 +1256,21 @@ var bstTyped = (() => {
1220
1256
  this._elements[this._offset + index] = newElement;
1221
1257
  return true;
1222
1258
  }
1259
+ /**
1260
+ * Delete the first element that satisfies a predicate.
1261
+ * @remarks Time O(N), Space O(N)
1262
+ * @param predicate - Function (value, index, queue) → boolean to decide deletion.
1263
+ * @returns True if a match was removed.
1264
+ */
1265
+ deleteWhere(predicate) {
1266
+ for (let i = 0; i < this.length; i++) {
1267
+ if (predicate(this._elements[this._offset + i], i, this)) {
1268
+ this.deleteAt(i);
1269
+ return true;
1270
+ }
1271
+ }
1272
+ return false;
1273
+ }
1223
1274
  /**
1224
1275
  * Reverse the queue in-place by compacting then reversing.
1225
1276
  * @remarks Time O(N), Space O(N)
@@ -1262,6 +1313,10 @@ var bstTyped = (() => {
1262
1313
 
1263
1314
 
1264
1315
 
1316
+
1317
+
1318
+
1319
+
1265
1320
 
1266
1321
 
1267
1322
 
@@ -1308,6 +1363,10 @@ var bstTyped = (() => {
1308
1363
 
1309
1364
 
1310
1365
 
1366
+
1367
+
1368
+
1369
+
1311
1370
 
1312
1371
 
1313
1372
 
@@ -1377,6 +1436,10 @@ var bstTyped = (() => {
1377
1436
 
1378
1437
 
1379
1438
 
1439
+
1440
+
1441
+
1442
+
1380
1443
 
1381
1444
 
1382
1445
 
@@ -1430,6 +1493,10 @@ var bstTyped = (() => {
1430
1493
 
1431
1494
 
1432
1495
 
1496
+
1497
+
1498
+
1499
+
1433
1500
 
1434
1501
 
1435
1502
 
@@ -1487,6 +1554,10 @@ var bstTyped = (() => {
1487
1554
 
1488
1555
 
1489
1556
 
1557
+
1558
+
1559
+
1560
+
1490
1561
 
1491
1562
 
1492
1563
 
@@ -1962,7 +2033,7 @@ var bstTyped = (() => {
1962
2033
  }
1963
2034
  /**
1964
2035
  * Adds a new node to the tree.
1965
- * @remarks Time O(log N), For BST, Red-Black Tree, and AVL Tree subclasses, the worst-case time is O(log N). This implementation adds the node at the first available position in a level-order (BFS) traversal. This is NOT a Binary Search Tree insertion. Time O(N), where N is the number of nodes. It must traverse level-by-level to find an empty slot. Space O(N) in the worst case for the BFS queue (e.g., a full last level).
2036
+ * @remarks Time O(N) level-order traversal to find an empty slot. Space O(N) for the BFS queue. BST/Red-Black Tree/AVL Tree subclasses override to O(log N).
1966
2037
  *
1967
2038
  * @param keyNodeOrEntry - The key, node, or entry to add.
1968
2039
  * @returns True if the addition was successful, false otherwise.
@@ -1991,6 +2062,10 @@ var bstTyped = (() => {
1991
2062
 
1992
2063
 
1993
2064
 
2065
+
2066
+
2067
+
2068
+
1994
2069
 
1995
2070
 
1996
2071
 
@@ -2010,7 +2085,7 @@ var bstTyped = (() => {
2010
2085
  }
2011
2086
  /**
2012
2087
  * Adds or updates a new node to the tree.
2013
- * @remarks Time O(log N), For BST, Red-Black Tree, and AVL Tree subclasses, the worst-case time is O(log N). This implementation sets the node at the first available position in a level-order (BFS) traversal. This is NOT a Binary Search Tree insertion. Time O(N), where N is the number of nodes. It must traverse level-by-level to find an empty slot. Space O(N) in the worst case for the BFS queue (e.g., a full last level).
2088
+ * @remarks Time O(N) level-order traversal to find an empty slot. Space O(N) for the BFS queue. BST/Red-Black Tree/AVL Tree subclasses override to O(log N).
2014
2089
  *
2015
2090
  * @param keyNodeOrEntry - The key, node, or entry to set or update.
2016
2091
  * @param [value] - The value, if providing just a key.
@@ -2045,6 +2120,10 @@ var bstTyped = (() => {
2045
2120
 
2046
2121
 
2047
2122
 
2123
+
2124
+
2125
+
2126
+
2048
2127
 
2049
2128
 
2050
2129
 
@@ -2151,6 +2230,10 @@ var bstTyped = (() => {
2151
2230
 
2152
2231
 
2153
2232
 
2233
+
2234
+
2235
+
2236
+
2154
2237
 
2155
2238
 
2156
2239
 
@@ -2193,6 +2276,10 @@ var bstTyped = (() => {
2193
2276
 
2194
2277
 
2195
2278
 
2279
+
2280
+
2281
+
2282
+
2196
2283
 
2197
2284
 
2198
2285
 
@@ -2256,6 +2343,10 @@ var bstTyped = (() => {
2256
2343
 
2257
2344
 
2258
2345
 
2346
+
2347
+
2348
+
2349
+
2259
2350
 
2260
2351
 
2261
2352
 
@@ -2272,22 +2363,66 @@ var bstTyped = (() => {
2272
2363
  this.setMany(anotherTree, []);
2273
2364
  }
2274
2365
  /**
2275
- * Clears the tree and refills it with new items.
2276
- * @remarks Time O(N) (for `clear`) + O(N * M) (for `setMany`) = O(N * M). Space O(M) (from `setMany`).
2366
+ * Deletes a node from the tree (internal, returns balancing metadata).
2367
+ * @remarks Time O(N) O(N) to find the node + O(H) for predecessor swap. Space O(1). BST/Red-Black Tree/AVL Tree subclasses override to O(log N).
2368
+ * @internal Used by AVL/BST subclasses that need balancing metadata after deletion.
2277
2369
  *
2278
- * @param keysNodesEntriesOrRaws - An iterable of items to set.
2279
- * @param [values] - An optional parallel iterable of values.
2370
+ * @param keyNodeEntryRawOrPredicate - The node to delete.
2371
+ * @returns An array containing deletion results with balancing metadata.
2280
2372
  */
2281
- refill(keysNodesEntriesOrRaws, values) {
2282
- this.clear();
2283
- this.setMany(keysNodesEntriesOrRaws, values);
2373
+ _deleteInternal(keyNodeEntryRawOrPredicate) {
2374
+ const deletedResult = [];
2375
+ if (!this._root) return deletedResult;
2376
+ const curr = this.getNode(keyNodeEntryRawOrPredicate);
2377
+ if (!curr) return deletedResult;
2378
+ const parent = curr == null ? void 0 : curr.parent;
2379
+ let needBalanced;
2380
+ let orgCurrent = curr;
2381
+ if (!curr.left && !curr.right && !parent) {
2382
+ this._setRoot(void 0);
2383
+ } else if (curr.left) {
2384
+ const leftSubTreeRightMost = this.getRightMost((node) => node, curr.left);
2385
+ if (leftSubTreeRightMost) {
2386
+ const parentOfLeftSubTreeMax = leftSubTreeRightMost.parent;
2387
+ orgCurrent = this._swapProperties(curr, leftSubTreeRightMost);
2388
+ if (this._isMapMode) {
2389
+ this._store.set(curr.key, curr);
2390
+ this._store.set(leftSubTreeRightMost.key, leftSubTreeRightMost);
2391
+ }
2392
+ if (parentOfLeftSubTreeMax) {
2393
+ if (parentOfLeftSubTreeMax.right === leftSubTreeRightMost)
2394
+ parentOfLeftSubTreeMax.right = leftSubTreeRightMost.left;
2395
+ else parentOfLeftSubTreeMax.left = leftSubTreeRightMost.left;
2396
+ needBalanced = parentOfLeftSubTreeMax;
2397
+ }
2398
+ }
2399
+ } else if (parent) {
2400
+ const { familyPosition: fp } = curr;
2401
+ if (fp === "LEFT" || fp === "ROOT_LEFT") {
2402
+ parent.left = curr.right;
2403
+ } else if (fp === "RIGHT" || fp === "ROOT_RIGHT") {
2404
+ parent.right = curr.right;
2405
+ }
2406
+ needBalanced = parent;
2407
+ } else {
2408
+ this._setRoot(curr.right);
2409
+ curr.right = void 0;
2410
+ }
2411
+ this._size = this._size - 1;
2412
+ deletedResult.push({ deleted: orgCurrent, needBalanced });
2413
+ if (this._isMapMode && orgCurrent) this._store.delete(orgCurrent.key);
2414
+ return deletedResult;
2284
2415
  }
2285
2416
  /**
2286
2417
  * Deletes a node from the tree.
2287
- * @remarks Time O(log N), For BST, Red-Black Tree, and AVL Tree subclasses, the worst-case time is O(log N). This implementation finds the node, and if it has two children, swaps it with the rightmost node of its left subtree (in-order predecessor) before deleting. Time O(N) in the worst case. O(N) to find the node (`getNode`) and O(H) (which is O(N) worst-case) to find the rightmost node. Space O(1) (if `getNode` is iterative, which it is).
2418
+ * @remarks Time O(N) O(N) to find the node + O(H) for predecessor swap. Space O(1). BST/Red-Black Tree/AVL Tree subclasses override to O(log N).
2288
2419
  *
2289
2420
  * @param keyNodeEntryRawOrPredicate - The node to delete.
2290
- * @returns An array containing deletion results (for compatibility with self-balancing trees).
2421
+ * @returns True if the node was found and deleted, false otherwise.
2422
+
2423
+
2424
+
2425
+
2291
2426
 
2292
2427
 
2293
2428
 
@@ -2331,51 +2466,11 @@ var bstTyped = (() => {
2331
2466
  * console.log(tree.size); // 4;
2332
2467
  */
2333
2468
  delete(keyNodeEntryRawOrPredicate) {
2334
- const deletedResult = [];
2335
- if (!this._root) return deletedResult;
2336
- const curr = this.getNode(keyNodeEntryRawOrPredicate);
2337
- if (!curr) return deletedResult;
2338
- const parent = curr == null ? void 0 : curr.parent;
2339
- let needBalanced;
2340
- let orgCurrent = curr;
2341
- if (!curr.left && !curr.right && !parent) {
2342
- this._setRoot(void 0);
2343
- } else if (curr.left) {
2344
- const leftSubTreeRightMost = this.getRightMost((node) => node, curr.left);
2345
- if (leftSubTreeRightMost) {
2346
- const parentOfLeftSubTreeMax = leftSubTreeRightMost.parent;
2347
- orgCurrent = this._swapProperties(curr, leftSubTreeRightMost);
2348
- if (this._isMapMode) {
2349
- this._store.set(curr.key, curr);
2350
- this._store.set(leftSubTreeRightMost.key, leftSubTreeRightMost);
2351
- }
2352
- if (parentOfLeftSubTreeMax) {
2353
- if (parentOfLeftSubTreeMax.right === leftSubTreeRightMost)
2354
- parentOfLeftSubTreeMax.right = leftSubTreeRightMost.left;
2355
- else parentOfLeftSubTreeMax.left = leftSubTreeRightMost.left;
2356
- needBalanced = parentOfLeftSubTreeMax;
2357
- }
2358
- }
2359
- } else if (parent) {
2360
- const { familyPosition: fp } = curr;
2361
- if (fp === "LEFT" || fp === "ROOT_LEFT") {
2362
- parent.left = curr.right;
2363
- } else if (fp === "RIGHT" || fp === "ROOT_RIGHT") {
2364
- parent.right = curr.right;
2365
- }
2366
- needBalanced = parent;
2367
- } else {
2368
- this._setRoot(curr.right);
2369
- curr.right = void 0;
2370
- }
2371
- this._size = this._size - 1;
2372
- deletedResult.push({ deleted: orgCurrent, needBalanced });
2373
- if (this._isMapMode && orgCurrent) this._store.delete(orgCurrent.key);
2374
- return deletedResult;
2469
+ return this._deleteInternal(keyNodeEntryRawOrPredicate).length > 0;
2375
2470
  }
2376
2471
  /**
2377
2472
  * Searches the tree for nodes matching a predicate.
2378
- * @remarks Time O(log N), For BST, Red-Black Tree, and AVL Tree subclasses, the worst-case time is O(log N). Performs a full DFS (pre-order) scan of the tree. Time O(N), as it may visit every node. Space O(H) for the call stack (recursive) or explicit stack (iterative), where H is the tree height (O(N) worst-case).
2473
+ * @remarks Time O(N) full DFS scan; may visit every node. Space O(H) for call/explicit stack (O(N) worst-case). BST subclasses with key search override to O(log N).
2379
2474
  *
2380
2475
  * @template C - The type of the callback function.
2381
2476
  * @param keyNodeEntryOrPredicate - The key, node, entry, or predicate function to search for.
@@ -2424,7 +2519,7 @@ var bstTyped = (() => {
2424
2519
  }
2425
2520
  /**
2426
2521
  * Gets the first node matching a predicate.
2427
- * @remarks Time O(log N), For BST, Red-Black Tree, and AVL Tree subclasses, the worst-case time is O(log N). Time O(N) in the worst case (via `search`). Space O(H) or O(N) (via `search`).
2522
+ * @remarks Time O(N) via `search`. Space O(H) or O(N). BST/Red-Black Tree/AVL Tree subclasses override to O(log N) for key lookups.
2428
2523
  *
2429
2524
  * @param keyNodeEntryOrPredicate - The key, node, entry, or predicate function to search for.
2430
2525
  * @param [startNode=this._root] - The node to start the search from.
@@ -2458,6 +2553,10 @@ var bstTyped = (() => {
2458
2553
 
2459
2554
 
2460
2555
 
2556
+
2557
+
2558
+
2559
+
2461
2560
 
2462
2561
 
2463
2562
 
@@ -2480,7 +2579,7 @@ var bstTyped = (() => {
2480
2579
  }
2481
2580
  /**
2482
2581
  * Gets the value associated with a key.
2483
- * @remarks Time O(log N), For BST, Red-Black Tree, and AVL Tree subclasses, the worst-case time is O(log N). Time O(1) if in Map mode. O(N) if not in Map mode (uses `getNode`). Space O(1) if in Map mode. O(H) or O(N) otherwise.
2582
+ * @remarks Time O(1) in Map mode, O(N) otherwise (via `getNode`). Space O(1) in Map mode, O(H) or O(N) otherwise. BST subclasses override non-Map-mode to O(log N).
2484
2583
  *
2485
2584
  * @param keyNodeEntryOrPredicate - The key, node, or entry to get the value for.
2486
2585
  * @param [startNode=this._root] - The node to start searching from (if not in Map mode).
@@ -2516,6 +2615,10 @@ var bstTyped = (() => {
2516
2615
 
2517
2616
 
2518
2617
 
2618
+
2619
+
2620
+
2621
+
2519
2622
 
2520
2623
 
2521
2624
 
@@ -2577,6 +2680,10 @@ var bstTyped = (() => {
2577
2680
 
2578
2681
 
2579
2682
 
2683
+
2684
+
2685
+
2686
+
2580
2687
 
2581
2688
 
2582
2689
 
@@ -2625,6 +2732,10 @@ var bstTyped = (() => {
2625
2732
 
2626
2733
 
2627
2734
 
2735
+
2736
+
2737
+
2738
+
2628
2739
 
2629
2740
 
2630
2741
 
@@ -2682,6 +2793,10 @@ var bstTyped = (() => {
2682
2793
 
2683
2794
 
2684
2795
 
2796
+
2797
+
2798
+
2799
+
2685
2800
 
2686
2801
 
2687
2802
 
@@ -2766,6 +2881,10 @@ var bstTyped = (() => {
2766
2881
 
2767
2882
 
2768
2883
 
2884
+
2885
+
2886
+
2887
+
2769
2888
 
2770
2889
 
2771
2890
 
@@ -2827,6 +2946,10 @@ var bstTyped = (() => {
2827
2946
 
2828
2947
 
2829
2948
 
2949
+
2950
+
2951
+
2952
+
2830
2953
 
2831
2954
 
2832
2955
 
@@ -3304,6 +3427,10 @@ var bstTyped = (() => {
3304
3427
 
3305
3428
 
3306
3429
 
3430
+
3431
+
3432
+
3433
+
3307
3434
 
3308
3435
 
3309
3436
 
@@ -3356,6 +3483,10 @@ var bstTyped = (() => {
3356
3483
 
3357
3484
 
3358
3485
 
3486
+
3487
+
3488
+
3489
+
3359
3490
 
3360
3491
 
3361
3492
 
@@ -3412,6 +3543,10 @@ var bstTyped = (() => {
3412
3543
 
3413
3544
 
3414
3545
 
3546
+
3547
+
3548
+
3549
+
3415
3550
 
3416
3551
 
3417
3552
 
@@ -3493,6 +3628,10 @@ var bstTyped = (() => {
3493
3628
 
3494
3629
 
3495
3630
 
3631
+
3632
+
3633
+
3634
+
3496
3635
 
3497
3636
 
3498
3637
 
@@ -4301,6 +4440,14 @@ var bstTyped = (() => {
4301
4440
 
4302
4441
 
4303
4442
 
4443
+
4444
+
4445
+
4446
+
4447
+
4448
+
4449
+
4450
+
4304
4451
 
4305
4452
 
4306
4453
 
@@ -4635,6 +4782,18 @@ var bstTyped = (() => {
4635
4782
 
4636
4783
 
4637
4784
 
4785
+
4786
+
4787
+
4788
+
4789
+
4790
+
4791
+
4792
+
4793
+
4794
+
4795
+
4796
+
4638
4797
 
4639
4798
 
4640
4799
 
@@ -4754,6 +4913,14 @@ var bstTyped = (() => {
4754
4913
 
4755
4914
 
4756
4915
 
4916
+
4917
+
4918
+
4919
+
4920
+
4921
+
4922
+
4923
+
4757
4924
 
4758
4925
 
4759
4926
 
@@ -5045,6 +5212,10 @@ var bstTyped = (() => {
5045
5212
 
5046
5213
 
5047
5214
 
5215
+
5216
+
5217
+
5218
+
5048
5219
 
5049
5220
 
5050
5221
 
@@ -5114,6 +5285,10 @@ var bstTyped = (() => {
5114
5285
 
5115
5286
 
5116
5287
 
5288
+
5289
+
5290
+
5291
+
5117
5292
 
5118
5293
 
5119
5294
 
@@ -5232,6 +5407,14 @@ var bstTyped = (() => {
5232
5407
 
5233
5408
 
5234
5409
 
5410
+
5411
+
5412
+
5413
+
5414
+
5415
+
5416
+
5417
+
5235
5418
 
5236
5419
 
5237
5420
 
@@ -5293,12 +5476,11 @@ var bstTyped = (() => {
5293
5476
  */
5294
5477
  deleteWhere(keyNodeEntryOrPredicate, onlyOne = false, startNode = this._root, iterationType = this.iterationType) {
5295
5478
  const toDelete = this.search(keyNodeEntryOrPredicate, onlyOne, (node) => node, startNode, iterationType);
5296
- let results = [];
5479
+ let deleted = false;
5297
5480
  for (const node of toDelete) {
5298
- const deleteInfo = this.delete(node);
5299
- results = results.concat(deleteInfo);
5481
+ if (this.delete(node)) deleted = true;
5300
5482
  }
5301
- return results;
5483
+ return deleted;
5302
5484
  }
5303
5485
  /**
5304
5486
  * (Protected) Creates the default comparator function for keys that don't have a custom comparator.