binary-tree-typed 2.5.0 → 2.5.1

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 (75) hide show
  1. package/dist/cjs/index.cjs +609 -0
  2. package/dist/cjs/index.cjs.map +1 -1
  3. package/dist/cjs-legacy/index.cjs +609 -0
  4. package/dist/cjs-legacy/index.cjs.map +1 -1
  5. package/dist/esm/index.mjs +609 -0
  6. package/dist/esm/index.mjs.map +1 -1
  7. package/dist/esm-legacy/index.mjs +609 -0
  8. package/dist/esm-legacy/index.mjs.map +1 -1
  9. package/dist/types/data-structures/base/index.d.ts +1 -0
  10. package/dist/types/data-structures/base/iterable-entry-base.d.ts +8 -8
  11. package/dist/types/data-structures/base/linear-base.d.ts +3 -3
  12. package/dist/types/data-structures/binary-tree/avl-tree.d.ts +252 -0
  13. package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +294 -0
  14. package/dist/types/data-structures/binary-tree/binary-tree.d.ts +527 -2
  15. package/dist/types/data-structures/binary-tree/bst.d.ts +505 -1
  16. package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +399 -0
  17. package/dist/types/data-structures/binary-tree/segment-tree.d.ts +126 -1
  18. package/dist/types/data-structures/binary-tree/tree-map.d.ts +2881 -382
  19. package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +2867 -347
  20. package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +2328 -312
  21. package/dist/types/data-structures/binary-tree/tree-set.d.ts +2671 -277
  22. package/dist/types/data-structures/graph/abstract-graph.d.ts +4 -4
  23. package/dist/types/data-structures/graph/directed-graph.d.ts +210 -0
  24. package/dist/types/data-structures/graph/undirected-graph.d.ts +189 -0
  25. package/dist/types/data-structures/hash/hash-map.d.ts +241 -10
  26. package/dist/types/data-structures/heap/heap.d.ts +294 -0
  27. package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +360 -3
  28. package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +318 -3
  29. package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +380 -2
  30. package/dist/types/data-structures/matrix/matrix.d.ts +168 -0
  31. package/dist/types/data-structures/queue/deque.d.ts +319 -4
  32. package/dist/types/data-structures/queue/queue.d.ts +252 -0
  33. package/dist/types/data-structures/stack/stack.d.ts +210 -0
  34. package/dist/types/data-structures/trie/trie.d.ts +256 -4
  35. package/dist/types/interfaces/graph.d.ts +1 -1
  36. package/dist/types/types/common.d.ts +2 -2
  37. package/dist/types/types/data-structures/heap/heap.d.ts +1 -0
  38. package/dist/types/types/data-structures/priority-queue/priority-queue.d.ts +1 -0
  39. package/dist/types/types/utils/validate-type.d.ts +4 -4
  40. package/dist/umd/binary-tree-typed.js +609 -0
  41. package/dist/umd/binary-tree-typed.js.map +1 -1
  42. package/dist/umd/binary-tree-typed.min.js +5 -5
  43. package/dist/umd/binary-tree-typed.min.js.map +1 -1
  44. package/package.json +2 -2
  45. package/src/data-structures/base/index.ts +1 -0
  46. package/src/data-structures/base/iterable-entry-base.ts +8 -8
  47. package/src/data-structures/base/linear-base.ts +3 -3
  48. package/src/data-structures/binary-tree/avl-tree.ts +252 -0
  49. package/src/data-structures/binary-tree/binary-indexed-tree.ts +295 -1
  50. package/src/data-structures/binary-tree/binary-tree.ts +527 -2
  51. package/src/data-structures/binary-tree/bst.ts +505 -1
  52. package/src/data-structures/binary-tree/red-black-tree.ts +399 -0
  53. package/src/data-structures/binary-tree/segment-tree.ts +127 -2
  54. package/src/data-structures/binary-tree/tree-map.ts +2958 -459
  55. package/src/data-structures/binary-tree/tree-multi-map.ts +3069 -549
  56. package/src/data-structures/binary-tree/tree-multi-set.ts +2476 -460
  57. package/src/data-structures/binary-tree/tree-set.ts +2816 -422
  58. package/src/data-structures/graph/abstract-graph.ts +4 -4
  59. package/src/data-structures/graph/directed-graph.ts +210 -0
  60. package/src/data-structures/graph/undirected-graph.ts +189 -0
  61. package/src/data-structures/hash/hash-map.ts +246 -15
  62. package/src/data-structures/heap/heap.ts +294 -0
  63. package/src/data-structures/linked-list/doubly-linked-list.ts +360 -3
  64. package/src/data-structures/linked-list/singly-linked-list.ts +318 -3
  65. package/src/data-structures/linked-list/skip-linked-list.ts +380 -2
  66. package/src/data-structures/matrix/matrix.ts +169 -1
  67. package/src/data-structures/queue/deque.ts +320 -5
  68. package/src/data-structures/queue/queue.ts +252 -0
  69. package/src/data-structures/stack/stack.ts +210 -0
  70. package/src/data-structures/trie/trie.ts +257 -5
  71. package/src/interfaces/graph.ts +1 -1
  72. package/src/types/common.ts +2 -2
  73. package/src/types/data-structures/heap/heap.ts +1 -0
  74. package/src/types/data-structures/priority-queue/priority-queue.ts +1 -0
  75. package/src/types/utils/validate-type.ts +4 -4
@@ -784,6 +784,27 @@ var binaryTreeTyped = (() => {
784
784
 
785
785
 
786
786
 
787
+
788
+
789
+
790
+
791
+
792
+
793
+
794
+
795
+
796
+
797
+
798
+
799
+
800
+
801
+
802
+
803
+
804
+
805
+
806
+
807
+
787
808
  * @example
788
809
  * // Track queue length
789
810
  * const q = new Queue<number>();
@@ -810,6 +831,27 @@ var binaryTreeTyped = (() => {
810
831
 
811
832
 
812
833
 
834
+
835
+
836
+
837
+
838
+
839
+
840
+
841
+
842
+
843
+
844
+
845
+
846
+
847
+
848
+
849
+
850
+
851
+
852
+
853
+
854
+
813
855
  * @example
814
856
  * // View the front element
815
857
  * const q = new Queue<string>(['first', 'second', 'third']);
@@ -852,6 +894,27 @@ var binaryTreeTyped = (() => {
852
894
 
853
895
 
854
896
 
897
+
898
+
899
+
900
+
901
+
902
+
903
+
904
+
905
+
906
+
907
+
908
+
909
+
910
+
911
+
912
+
913
+
914
+
915
+
916
+
917
+
855
918
  * @example
856
919
  * // Queue for...of iteration and isEmpty check
857
920
  * const queue = new Queue<string>(['A', 'B', 'C', 'D']);
@@ -890,6 +953,27 @@ var binaryTreeTyped = (() => {
890
953
 
891
954
 
892
955
 
956
+
957
+
958
+
959
+
960
+
961
+
962
+
963
+
964
+
965
+
966
+
967
+
968
+
969
+
970
+
971
+
972
+
973
+
974
+
975
+
976
+
893
977
  * @example
894
978
  * // basic Queue creation and push operation
895
979
  * // Create a simple Queue with initial values
@@ -935,6 +1019,27 @@ var binaryTreeTyped = (() => {
935
1019
 
936
1020
 
937
1021
 
1022
+
1023
+
1024
+
1025
+
1026
+
1027
+
1028
+
1029
+
1030
+
1031
+
1032
+
1033
+
1034
+
1035
+
1036
+
1037
+
1038
+
1039
+
1040
+
1041
+
1042
+
938
1043
  * @example
939
1044
  * // Queue shift and peek operations
940
1045
  * const queue = new Queue<number>([10, 20, 30, 40]);
@@ -970,6 +1075,27 @@ var binaryTreeTyped = (() => {
970
1075
 
971
1076
 
972
1077
 
1078
+
1079
+
1080
+
1081
+
1082
+
1083
+
1084
+
1085
+
1086
+
1087
+
1088
+
1089
+
1090
+
1091
+
1092
+
1093
+
1094
+
1095
+
1096
+
1097
+
1098
+
973
1099
  * @example
974
1100
  * // Remove specific element
975
1101
  * const q = new Queue<number>([1, 2, 3, 2]);
@@ -998,6 +1124,27 @@ var binaryTreeTyped = (() => {
998
1124
 
999
1125
 
1000
1126
 
1127
+
1128
+
1129
+
1130
+
1131
+
1132
+
1133
+
1134
+
1135
+
1136
+
1137
+
1138
+
1139
+
1140
+
1141
+
1142
+
1143
+
1144
+
1145
+
1146
+
1147
+
1001
1148
  * @example
1002
1149
  * // Access element by index
1003
1150
  * const q = new Queue<string>(['a', 'b', 'c']);
@@ -1067,6 +1214,27 @@ var binaryTreeTyped = (() => {
1067
1214
 
1068
1215
 
1069
1216
 
1217
+
1218
+
1219
+
1220
+
1221
+
1222
+
1223
+
1224
+
1225
+
1226
+
1227
+
1228
+
1229
+
1230
+
1231
+
1232
+
1233
+
1234
+
1235
+
1236
+
1237
+
1070
1238
  * @example
1071
1239
  * // Remove all elements
1072
1240
  * const q = new Queue<number>([1, 2, 3]);
@@ -1089,6 +1257,27 @@ var binaryTreeTyped = (() => {
1089
1257
 
1090
1258
 
1091
1259
 
1260
+
1261
+
1262
+
1263
+
1264
+
1265
+
1266
+
1267
+
1268
+
1269
+
1270
+
1271
+
1272
+
1273
+
1274
+
1275
+
1276
+
1277
+
1278
+
1279
+
1280
+
1092
1281
  * @example
1093
1282
  * // Reclaim unused memory
1094
1283
  * const q = new Queue<number>([1, 2, 3, 4, 5]);
@@ -1134,6 +1323,27 @@ var binaryTreeTyped = (() => {
1134
1323
 
1135
1324
 
1136
1325
 
1326
+
1327
+
1328
+
1329
+
1330
+
1331
+
1332
+
1333
+
1334
+
1335
+
1336
+
1337
+
1338
+
1339
+
1340
+
1341
+
1342
+
1343
+
1344
+
1345
+
1346
+
1137
1347
  * @example
1138
1348
  * // Create independent copy
1139
1349
  * const q = new Queue<number>([1, 2, 3]);
@@ -1163,6 +1373,27 @@ var binaryTreeTyped = (() => {
1163
1373
 
1164
1374
 
1165
1375
 
1376
+
1377
+
1378
+
1379
+
1380
+
1381
+
1382
+
1383
+
1384
+
1385
+
1386
+
1387
+
1388
+
1389
+
1390
+
1391
+
1392
+
1393
+
1394
+
1395
+
1396
+
1166
1397
  * @example
1167
1398
  * // Filter elements
1168
1399
  * const q = new Queue<number>([1, 2, 3, 4, 5]);
@@ -1196,6 +1427,27 @@ var binaryTreeTyped = (() => {
1196
1427
 
1197
1428
 
1198
1429
 
1430
+
1431
+
1432
+
1433
+
1434
+
1435
+
1436
+
1437
+
1438
+
1439
+
1440
+
1441
+
1442
+
1443
+
1444
+
1445
+
1446
+
1447
+
1448
+
1449
+
1450
+
1199
1451
  * @example
1200
1452
  * // Transform elements
1201
1453
  * const q = new Queue<number>([1, 2, 3]);
@@ -1676,6 +1928,27 @@ var binaryTreeTyped = (() => {
1676
1928
 
1677
1929
 
1678
1930
 
1931
+
1932
+
1933
+
1934
+
1935
+
1936
+
1937
+
1938
+
1939
+
1940
+
1941
+
1942
+
1943
+
1944
+
1945
+
1946
+
1947
+
1948
+
1949
+
1950
+
1951
+
1679
1952
  * @example
1680
1953
  * // Add a single node
1681
1954
  * const tree = new BinaryTree<number>();
@@ -1706,6 +1979,27 @@ var binaryTreeTyped = (() => {
1706
1979
 
1707
1980
 
1708
1981
 
1982
+
1983
+
1984
+
1985
+
1986
+
1987
+
1988
+
1989
+
1990
+
1991
+
1992
+
1993
+
1994
+
1995
+
1996
+
1997
+
1998
+
1999
+
2000
+
2001
+
2002
+
1709
2003
  * @example
1710
2004
  * // basic BinaryTree creation and insertion
1711
2005
  * // Create a BinaryTree with entries
@@ -1788,6 +2082,27 @@ var binaryTreeTyped = (() => {
1788
2082
 
1789
2083
 
1790
2084
 
2085
+
2086
+
2087
+
2088
+
2089
+
2090
+
2091
+
2092
+
2093
+
2094
+
2095
+
2096
+
2097
+
2098
+
2099
+
2100
+
2101
+
2102
+
2103
+
2104
+
2105
+
1791
2106
  * @example
1792
2107
  * // Bulk add
1793
2108
  * const tree = new BinaryTree<number>();
@@ -1806,6 +2121,27 @@ var binaryTreeTyped = (() => {
1806
2121
  * @returns An array of booleans indicating the success of each individual `set` operation.
1807
2122
 
1808
2123
 
2124
+
2125
+
2126
+
2127
+
2128
+
2129
+
2130
+
2131
+
2132
+
2133
+
2134
+
2135
+
2136
+
2137
+
2138
+
2139
+
2140
+
2141
+
2142
+
2143
+
2144
+
1809
2145
  * @example
1810
2146
  * // Set multiple entries
1811
2147
  * const tree = new BinaryTree<number, string>();
@@ -1845,6 +2181,27 @@ var binaryTreeTyped = (() => {
1845
2181
 
1846
2182
 
1847
2183
 
2184
+
2185
+
2186
+
2187
+
2188
+
2189
+
2190
+
2191
+
2192
+
2193
+
2194
+
2195
+
2196
+
2197
+
2198
+
2199
+
2200
+
2201
+
2202
+
2203
+
2204
+
1848
2205
  * @example
1849
2206
  * // Combine trees
1850
2207
  * const t1 = new BinaryTree<number>([1, 2]);
@@ -1883,6 +2240,27 @@ var binaryTreeTyped = (() => {
1883
2240
 
1884
2241
 
1885
2242
 
2243
+
2244
+
2245
+
2246
+
2247
+
2248
+
2249
+
2250
+
2251
+
2252
+
2253
+
2254
+
2255
+
2256
+
2257
+
2258
+
2259
+
2260
+
2261
+
2262
+
2263
+
1886
2264
  * @example
1887
2265
  * // Remove a node
1888
2266
  * const tree = new BinaryTree<number>([1, 2, 3, 4, 5]);
@@ -1999,6 +2377,27 @@ var binaryTreeTyped = (() => {
1999
2377
 
2000
2378
 
2001
2379
 
2380
+
2381
+
2382
+
2383
+
2384
+
2385
+
2386
+
2387
+
2388
+
2389
+
2390
+
2391
+
2392
+
2393
+
2394
+
2395
+
2396
+
2397
+
2398
+
2399
+
2400
+
2002
2401
  * @example
2003
2402
  * // Get node by key
2004
2403
  * const tree = new BinaryTree<number, string>([[1, 'root'], [2, 'child']]);
@@ -2033,6 +2432,27 @@ var binaryTreeTyped = (() => {
2033
2432
 
2034
2433
 
2035
2434
 
2435
+
2436
+
2437
+
2438
+
2439
+
2440
+
2441
+
2442
+
2443
+
2444
+
2445
+
2446
+
2447
+
2448
+
2449
+
2450
+
2451
+
2452
+
2453
+
2454
+
2455
+
2036
2456
  * @example
2037
2457
  * // Retrieve value by key
2038
2458
  * const tree = new BinaryTree<number, string>([[1, 'root'], [2, 'left'], [3, 'right']]);
@@ -2070,6 +2490,27 @@ var binaryTreeTyped = (() => {
2070
2490
 
2071
2491
 
2072
2492
 
2493
+
2494
+
2495
+
2496
+
2497
+
2498
+
2499
+
2500
+
2501
+
2502
+
2503
+
2504
+
2505
+
2506
+
2507
+
2508
+
2509
+
2510
+
2511
+
2512
+
2513
+
2073
2514
  * @example
2074
2515
  * // Remove all nodes
2075
2516
  * const tree = new BinaryTree<number>([1, 2, 3]);
@@ -2094,6 +2535,27 @@ var binaryTreeTyped = (() => {
2094
2535
 
2095
2536
 
2096
2537
 
2538
+
2539
+
2540
+
2541
+
2542
+
2543
+
2544
+
2545
+
2546
+
2547
+
2548
+
2549
+
2550
+
2551
+
2552
+
2553
+
2554
+
2555
+
2556
+
2557
+
2558
+
2097
2559
  * @example
2098
2560
  * // Check empty
2099
2561
  * console.log(new BinaryTree().isEmpty()); // true;
@@ -2127,6 +2589,27 @@ var binaryTreeTyped = (() => {
2127
2589
 
2128
2590
 
2129
2591
 
2592
+
2593
+
2594
+
2595
+
2596
+
2597
+
2598
+
2599
+
2600
+
2601
+
2602
+
2603
+
2604
+
2605
+
2606
+
2607
+
2608
+
2609
+
2610
+
2611
+
2612
+
2130
2613
  * @example
2131
2614
  * // Check BST property
2132
2615
  * const tree = new BinaryTree<number>([1, 2, 3]);
@@ -2187,6 +2670,27 @@ var binaryTreeTyped = (() => {
2187
2670
 
2188
2671
 
2189
2672
 
2673
+
2674
+
2675
+
2676
+
2677
+
2678
+
2679
+
2680
+
2681
+
2682
+
2683
+
2684
+
2685
+
2686
+
2687
+
2688
+
2689
+
2690
+
2691
+
2692
+
2693
+
2190
2694
  * @example
2191
2695
  * // Get depth of a node
2192
2696
  * const tree = new BinaryTree<number>([1, 2, 3, 4, 5]);
@@ -2224,6 +2728,27 @@ var binaryTreeTyped = (() => {
2224
2728
 
2225
2729
 
2226
2730
 
2731
+
2732
+
2733
+
2734
+
2735
+
2736
+
2737
+
2738
+
2739
+
2740
+
2741
+
2742
+
2743
+
2744
+
2745
+
2746
+
2747
+
2748
+
2749
+
2750
+
2751
+
2227
2752
  * @example
2228
2753
  * // Get tree height
2229
2754
  * const tree = new BinaryTree<number>([1, 2, 3, 4, 5]);
@@ -2677,6 +3202,27 @@ var binaryTreeTyped = (() => {
2677
3202
 
2678
3203
 
2679
3204
 
3205
+
3206
+
3207
+
3208
+
3209
+
3210
+
3211
+
3212
+
3213
+
3214
+
3215
+
3216
+
3217
+
3218
+
3219
+
3220
+
3221
+
3222
+
3223
+
3224
+
3225
+
2680
3226
  * @example
2681
3227
  * // Deep copy
2682
3228
  * const tree = new BinaryTree<number>([1, 2, 3]);
@@ -2705,6 +3251,27 @@ var binaryTreeTyped = (() => {
2705
3251
 
2706
3252
 
2707
3253
 
3254
+
3255
+
3256
+
3257
+
3258
+
3259
+
3260
+
3261
+
3262
+
3263
+
3264
+
3265
+
3266
+
3267
+
3268
+
3269
+
3270
+
3271
+
3272
+
3273
+
3274
+
2708
3275
  * @example
2709
3276
  * // Filter nodes by condition
2710
3277
  * const tree = new BinaryTree<number>([1, 2, 3, 4]);
@@ -2737,6 +3304,27 @@ var binaryTreeTyped = (() => {
2737
3304
 
2738
3305
 
2739
3306
 
3307
+
3308
+
3309
+
3310
+
3311
+
3312
+
3313
+
3314
+
3315
+
3316
+
3317
+
3318
+
3319
+
3320
+
3321
+
3322
+
3323
+
3324
+
3325
+
3326
+
3327
+
2740
3328
  * @example
2741
3329
  * // Transform to new tree
2742
3330
  * const tree = new BinaryTree<number, number>([[1, 10], [2, 20]]);
@@ -2794,6 +3382,27 @@ var binaryTreeTyped = (() => {
2794
3382
 
2795
3383
 
2796
3384
 
3385
+
3386
+
3387
+
3388
+
3389
+
3390
+
3391
+
3392
+
3393
+
3394
+
3395
+
3396
+
3397
+
3398
+
3399
+
3400
+
3401
+
3402
+
3403
+
3404
+
3405
+
2797
3406
  * @example
2798
3407
  * // Display tree
2799
3408
  * const tree = new BinaryTree<number>([1, 2, 3]);