singly-linked-list-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.
- package/dist/cjs/index.cjs +315 -0
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs-legacy/index.cjs +315 -0
- package/dist/cjs-legacy/index.cjs.map +1 -1
- package/dist/esm/index.mjs +315 -0
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm-legacy/index.mjs +315 -0
- package/dist/esm-legacy/index.mjs.map +1 -1
- package/dist/types/data-structures/base/index.d.ts +1 -0
- package/dist/types/data-structures/base/iterable-entry-base.d.ts +8 -8
- package/dist/types/data-structures/base/linear-base.d.ts +3 -3
- package/dist/types/data-structures/binary-tree/avl-tree.d.ts +252 -0
- package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +294 -0
- package/dist/types/data-structures/binary-tree/binary-tree.d.ts +527 -2
- package/dist/types/data-structures/binary-tree/bst.d.ts +505 -1
- package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +399 -0
- package/dist/types/data-structures/binary-tree/segment-tree.d.ts +126 -1
- package/dist/types/data-structures/binary-tree/tree-map.d.ts +2881 -382
- package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +2867 -347
- package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +2328 -312
- package/dist/types/data-structures/binary-tree/tree-set.d.ts +2671 -277
- package/dist/types/data-structures/graph/abstract-graph.d.ts +4 -4
- package/dist/types/data-structures/graph/directed-graph.d.ts +210 -0
- package/dist/types/data-structures/graph/undirected-graph.d.ts +189 -0
- package/dist/types/data-structures/hash/hash-map.d.ts +241 -10
- package/dist/types/data-structures/heap/heap.d.ts +294 -0
- package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +360 -3
- package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +318 -3
- package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +380 -2
- package/dist/types/data-structures/matrix/matrix.d.ts +168 -0
- package/dist/types/data-structures/queue/deque.d.ts +319 -4
- package/dist/types/data-structures/queue/queue.d.ts +252 -0
- package/dist/types/data-structures/stack/stack.d.ts +210 -0
- package/dist/types/data-structures/trie/trie.d.ts +256 -4
- package/dist/types/interfaces/graph.d.ts +1 -1
- package/dist/types/types/common.d.ts +2 -2
- package/dist/types/types/data-structures/heap/heap.d.ts +1 -0
- package/dist/types/types/data-structures/priority-queue/priority-queue.d.ts +1 -0
- package/dist/types/types/utils/validate-type.d.ts +4 -4
- package/dist/umd/singly-linked-list-typed.js +315 -0
- package/dist/umd/singly-linked-list-typed.js.map +1 -1
- package/dist/umd/singly-linked-list-typed.min.js +1 -1
- package/dist/umd/singly-linked-list-typed.min.js.map +1 -1
- package/package.json +2 -2
- package/src/data-structures/base/index.ts +1 -0
- package/src/data-structures/base/iterable-entry-base.ts +8 -8
- package/src/data-structures/base/linear-base.ts +3 -3
- package/src/data-structures/binary-tree/avl-tree.ts +252 -0
- package/src/data-structures/binary-tree/binary-indexed-tree.ts +295 -1
- package/src/data-structures/binary-tree/binary-tree.ts +527 -2
- package/src/data-structures/binary-tree/bst.ts +505 -1
- package/src/data-structures/binary-tree/red-black-tree.ts +399 -0
- package/src/data-structures/binary-tree/segment-tree.ts +127 -2
- package/src/data-structures/binary-tree/tree-map.ts +2958 -459
- package/src/data-structures/binary-tree/tree-multi-map.ts +3069 -549
- package/src/data-structures/binary-tree/tree-multi-set.ts +2476 -460
- package/src/data-structures/binary-tree/tree-set.ts +2816 -422
- package/src/data-structures/graph/abstract-graph.ts +4 -4
- package/src/data-structures/graph/directed-graph.ts +210 -0
- package/src/data-structures/graph/undirected-graph.ts +189 -0
- package/src/data-structures/hash/hash-map.ts +246 -15
- package/src/data-structures/heap/heap.ts +294 -0
- package/src/data-structures/linked-list/doubly-linked-list.ts +360 -3
- package/src/data-structures/linked-list/singly-linked-list.ts +318 -3
- package/src/data-structures/linked-list/skip-linked-list.ts +380 -2
- package/src/data-structures/matrix/matrix.ts +169 -1
- package/src/data-structures/queue/deque.ts +320 -5
- package/src/data-structures/queue/queue.ts +252 -0
- package/src/data-structures/stack/stack.ts +210 -0
- package/src/data-structures/trie/trie.ts +257 -5
- package/src/interfaces/graph.ts +1 -1
- package/src/types/common.ts +2 -2
- package/src/types/data-structures/heap/heap.ts +1 -0
- package/src/types/data-structures/priority-queue/priority-queue.ts +1 -0
- package/src/types/utils/validate-type.ts +4 -4
package/dist/cjs/index.cjs
CHANGED
|
@@ -740,6 +740,27 @@ var SinglyLinkedList = class extends LinearLinkedBase {
|
|
|
740
740
|
|
|
741
741
|
|
|
742
742
|
|
|
743
|
+
|
|
744
|
+
|
|
745
|
+
|
|
746
|
+
|
|
747
|
+
|
|
748
|
+
|
|
749
|
+
|
|
750
|
+
|
|
751
|
+
|
|
752
|
+
|
|
753
|
+
|
|
754
|
+
|
|
755
|
+
|
|
756
|
+
|
|
757
|
+
|
|
758
|
+
|
|
759
|
+
|
|
760
|
+
|
|
761
|
+
|
|
762
|
+
|
|
763
|
+
|
|
743
764
|
* @example
|
|
744
765
|
* // basic SinglyLinkedList creation and push operation
|
|
745
766
|
* // Create a simple SinglyLinkedList with initial values
|
|
@@ -783,6 +804,27 @@ var SinglyLinkedList = class extends LinearLinkedBase {
|
|
|
783
804
|
|
|
784
805
|
|
|
785
806
|
|
|
807
|
+
|
|
808
|
+
|
|
809
|
+
|
|
810
|
+
|
|
811
|
+
|
|
812
|
+
|
|
813
|
+
|
|
814
|
+
|
|
815
|
+
|
|
816
|
+
|
|
817
|
+
|
|
818
|
+
|
|
819
|
+
|
|
820
|
+
|
|
821
|
+
|
|
822
|
+
|
|
823
|
+
|
|
824
|
+
|
|
825
|
+
|
|
826
|
+
|
|
827
|
+
|
|
786
828
|
* @example
|
|
787
829
|
* // SinglyLinkedList pop and shift operations
|
|
788
830
|
* const list = new SinglyLinkedList<number>([10, 20, 30, 40, 50]);
|
|
@@ -831,6 +873,27 @@ var SinglyLinkedList = class extends LinearLinkedBase {
|
|
|
831
873
|
|
|
832
874
|
|
|
833
875
|
|
|
876
|
+
|
|
877
|
+
|
|
878
|
+
|
|
879
|
+
|
|
880
|
+
|
|
881
|
+
|
|
882
|
+
|
|
883
|
+
|
|
884
|
+
|
|
885
|
+
|
|
886
|
+
|
|
887
|
+
|
|
888
|
+
|
|
889
|
+
|
|
890
|
+
|
|
891
|
+
|
|
892
|
+
|
|
893
|
+
|
|
894
|
+
|
|
895
|
+
|
|
896
|
+
|
|
834
897
|
* @example
|
|
835
898
|
* // Remove from the front
|
|
836
899
|
* const list = new SinglyLinkedList<number>([10, 20, 30]);
|
|
@@ -861,6 +924,27 @@ var SinglyLinkedList = class extends LinearLinkedBase {
|
|
|
861
924
|
|
|
862
925
|
|
|
863
926
|
|
|
927
|
+
|
|
928
|
+
|
|
929
|
+
|
|
930
|
+
|
|
931
|
+
|
|
932
|
+
|
|
933
|
+
|
|
934
|
+
|
|
935
|
+
|
|
936
|
+
|
|
937
|
+
|
|
938
|
+
|
|
939
|
+
|
|
940
|
+
|
|
941
|
+
|
|
942
|
+
|
|
943
|
+
|
|
944
|
+
|
|
945
|
+
|
|
946
|
+
|
|
947
|
+
|
|
864
948
|
* @example
|
|
865
949
|
* // SinglyLinkedList unshift and forward traversal
|
|
866
950
|
* const list = new SinglyLinkedList<number>([20, 30, 40]);
|
|
@@ -952,6 +1036,27 @@ var SinglyLinkedList = class extends LinearLinkedBase {
|
|
|
952
1036
|
|
|
953
1037
|
|
|
954
1038
|
|
|
1039
|
+
|
|
1040
|
+
|
|
1041
|
+
|
|
1042
|
+
|
|
1043
|
+
|
|
1044
|
+
|
|
1045
|
+
|
|
1046
|
+
|
|
1047
|
+
|
|
1048
|
+
|
|
1049
|
+
|
|
1050
|
+
|
|
1051
|
+
|
|
1052
|
+
|
|
1053
|
+
|
|
1054
|
+
|
|
1055
|
+
|
|
1056
|
+
|
|
1057
|
+
|
|
1058
|
+
|
|
1059
|
+
|
|
955
1060
|
* @example
|
|
956
1061
|
* // Access element by index
|
|
957
1062
|
* const list = new SinglyLinkedList<string>(['a', 'b', 'c', 'd']);
|
|
@@ -987,6 +1092,27 @@ var SinglyLinkedList = class extends LinearLinkedBase {
|
|
|
987
1092
|
|
|
988
1093
|
|
|
989
1094
|
|
|
1095
|
+
|
|
1096
|
+
|
|
1097
|
+
|
|
1098
|
+
|
|
1099
|
+
|
|
1100
|
+
|
|
1101
|
+
|
|
1102
|
+
|
|
1103
|
+
|
|
1104
|
+
|
|
1105
|
+
|
|
1106
|
+
|
|
1107
|
+
|
|
1108
|
+
|
|
1109
|
+
|
|
1110
|
+
|
|
1111
|
+
|
|
1112
|
+
|
|
1113
|
+
|
|
1114
|
+
|
|
1115
|
+
|
|
990
1116
|
* @example
|
|
991
1117
|
* // Get node at index
|
|
992
1118
|
* const list = new SinglyLinkedList<string>(['a', 'b', 'c']);
|
|
@@ -1011,6 +1137,27 @@ var SinglyLinkedList = class extends LinearLinkedBase {
|
|
|
1011
1137
|
|
|
1012
1138
|
|
|
1013
1139
|
|
|
1140
|
+
|
|
1141
|
+
|
|
1142
|
+
|
|
1143
|
+
|
|
1144
|
+
|
|
1145
|
+
|
|
1146
|
+
|
|
1147
|
+
|
|
1148
|
+
|
|
1149
|
+
|
|
1150
|
+
|
|
1151
|
+
|
|
1152
|
+
|
|
1153
|
+
|
|
1154
|
+
|
|
1155
|
+
|
|
1156
|
+
|
|
1157
|
+
|
|
1158
|
+
|
|
1159
|
+
|
|
1160
|
+
|
|
1014
1161
|
* @example
|
|
1015
1162
|
* // Remove by index
|
|
1016
1163
|
* const list = new SinglyLinkedList<string>(['a', 'b', 'c']);
|
|
@@ -1041,6 +1188,27 @@ var SinglyLinkedList = class extends LinearLinkedBase {
|
|
|
1041
1188
|
|
|
1042
1189
|
|
|
1043
1190
|
|
|
1191
|
+
|
|
1192
|
+
|
|
1193
|
+
|
|
1194
|
+
|
|
1195
|
+
|
|
1196
|
+
|
|
1197
|
+
|
|
1198
|
+
|
|
1199
|
+
|
|
1200
|
+
|
|
1201
|
+
|
|
1202
|
+
|
|
1203
|
+
|
|
1204
|
+
|
|
1205
|
+
|
|
1206
|
+
|
|
1207
|
+
|
|
1208
|
+
|
|
1209
|
+
|
|
1210
|
+
|
|
1211
|
+
|
|
1044
1212
|
* @example
|
|
1045
1213
|
* // Remove first occurrence
|
|
1046
1214
|
* const list = new SinglyLinkedList<number>([1, 2, 3, 2]);
|
|
@@ -1076,6 +1244,27 @@ var SinglyLinkedList = class extends LinearLinkedBase {
|
|
|
1076
1244
|
|
|
1077
1245
|
|
|
1078
1246
|
|
|
1247
|
+
|
|
1248
|
+
|
|
1249
|
+
|
|
1250
|
+
|
|
1251
|
+
|
|
1252
|
+
|
|
1253
|
+
|
|
1254
|
+
|
|
1255
|
+
|
|
1256
|
+
|
|
1257
|
+
|
|
1258
|
+
|
|
1259
|
+
|
|
1260
|
+
|
|
1261
|
+
|
|
1262
|
+
|
|
1263
|
+
|
|
1264
|
+
|
|
1265
|
+
|
|
1266
|
+
|
|
1267
|
+
|
|
1079
1268
|
* @example
|
|
1080
1269
|
* // Insert at index
|
|
1081
1270
|
* const list = new SinglyLinkedList<number>([1, 3]);
|
|
@@ -1119,6 +1308,27 @@ var SinglyLinkedList = class extends LinearLinkedBase {
|
|
|
1119
1308
|
|
|
1120
1309
|
|
|
1121
1310
|
|
|
1311
|
+
|
|
1312
|
+
|
|
1313
|
+
|
|
1314
|
+
|
|
1315
|
+
|
|
1316
|
+
|
|
1317
|
+
|
|
1318
|
+
|
|
1319
|
+
|
|
1320
|
+
|
|
1321
|
+
|
|
1322
|
+
|
|
1323
|
+
|
|
1324
|
+
|
|
1325
|
+
|
|
1326
|
+
|
|
1327
|
+
|
|
1328
|
+
|
|
1329
|
+
|
|
1330
|
+
|
|
1331
|
+
|
|
1122
1332
|
* @example
|
|
1123
1333
|
* // Check empty
|
|
1124
1334
|
* console.log(new SinglyLinkedList().isEmpty()); // true;
|
|
@@ -1139,6 +1349,27 @@ var SinglyLinkedList = class extends LinearLinkedBase {
|
|
|
1139
1349
|
|
|
1140
1350
|
|
|
1141
1351
|
|
|
1352
|
+
|
|
1353
|
+
|
|
1354
|
+
|
|
1355
|
+
|
|
1356
|
+
|
|
1357
|
+
|
|
1358
|
+
|
|
1359
|
+
|
|
1360
|
+
|
|
1361
|
+
|
|
1362
|
+
|
|
1363
|
+
|
|
1364
|
+
|
|
1365
|
+
|
|
1366
|
+
|
|
1367
|
+
|
|
1368
|
+
|
|
1369
|
+
|
|
1370
|
+
|
|
1371
|
+
|
|
1372
|
+
|
|
1142
1373
|
* @example
|
|
1143
1374
|
* // Remove all
|
|
1144
1375
|
* const list = new SinglyLinkedList<number>([1, 2, 3]);
|
|
@@ -1165,6 +1396,27 @@ var SinglyLinkedList = class extends LinearLinkedBase {
|
|
|
1165
1396
|
|
|
1166
1397
|
|
|
1167
1398
|
|
|
1399
|
+
|
|
1400
|
+
|
|
1401
|
+
|
|
1402
|
+
|
|
1403
|
+
|
|
1404
|
+
|
|
1405
|
+
|
|
1406
|
+
|
|
1407
|
+
|
|
1408
|
+
|
|
1409
|
+
|
|
1410
|
+
|
|
1411
|
+
|
|
1412
|
+
|
|
1413
|
+
|
|
1414
|
+
|
|
1415
|
+
|
|
1416
|
+
|
|
1417
|
+
|
|
1418
|
+
|
|
1419
|
+
|
|
1168
1420
|
* @example
|
|
1169
1421
|
* // Reverse the list in-place
|
|
1170
1422
|
* const list = new SinglyLinkedList<number>([1, 2, 3, 4]);
|
|
@@ -1357,6 +1609,27 @@ var SinglyLinkedList = class extends LinearLinkedBase {
|
|
|
1357
1609
|
|
|
1358
1610
|
|
|
1359
1611
|
|
|
1612
|
+
|
|
1613
|
+
|
|
1614
|
+
|
|
1615
|
+
|
|
1616
|
+
|
|
1617
|
+
|
|
1618
|
+
|
|
1619
|
+
|
|
1620
|
+
|
|
1621
|
+
|
|
1622
|
+
|
|
1623
|
+
|
|
1624
|
+
|
|
1625
|
+
|
|
1626
|
+
|
|
1627
|
+
|
|
1628
|
+
|
|
1629
|
+
|
|
1630
|
+
|
|
1631
|
+
|
|
1632
|
+
|
|
1360
1633
|
* @example
|
|
1361
1634
|
* // Deep copy
|
|
1362
1635
|
* const list = new SinglyLinkedList<number>([1, 2, 3]);
|
|
@@ -1387,6 +1660,27 @@ var SinglyLinkedList = class extends LinearLinkedBase {
|
|
|
1387
1660
|
|
|
1388
1661
|
|
|
1389
1662
|
|
|
1663
|
+
|
|
1664
|
+
|
|
1665
|
+
|
|
1666
|
+
|
|
1667
|
+
|
|
1668
|
+
|
|
1669
|
+
|
|
1670
|
+
|
|
1671
|
+
|
|
1672
|
+
|
|
1673
|
+
|
|
1674
|
+
|
|
1675
|
+
|
|
1676
|
+
|
|
1677
|
+
|
|
1678
|
+
|
|
1679
|
+
|
|
1680
|
+
|
|
1681
|
+
|
|
1682
|
+
|
|
1683
|
+
|
|
1390
1684
|
* @example
|
|
1391
1685
|
* // SinglyLinkedList filter and map operations
|
|
1392
1686
|
* const list = new SinglyLinkedList<number>([1, 2, 3, 4, 5]);
|
|
@@ -1445,6 +1739,27 @@ var SinglyLinkedList = class extends LinearLinkedBase {
|
|
|
1445
1739
|
|
|
1446
1740
|
|
|
1447
1741
|
|
|
1742
|
+
|
|
1743
|
+
|
|
1744
|
+
|
|
1745
|
+
|
|
1746
|
+
|
|
1747
|
+
|
|
1748
|
+
|
|
1749
|
+
|
|
1750
|
+
|
|
1751
|
+
|
|
1752
|
+
|
|
1753
|
+
|
|
1754
|
+
|
|
1755
|
+
|
|
1756
|
+
|
|
1757
|
+
|
|
1758
|
+
|
|
1759
|
+
|
|
1760
|
+
|
|
1761
|
+
|
|
1762
|
+
|
|
1448
1763
|
* @example
|
|
1449
1764
|
* // Transform elements
|
|
1450
1765
|
* const list = new SinglyLinkedList<number>([1, 2, 3]);
|