data-structure-typed 2.6.0 → 2.6.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 (80) hide show
  1. package/.github/workflows/ci.yml +7 -2
  2. package/.github/workflows/release-package.yml +9 -2
  3. package/docs-site-docusaurus/docs/api/classes/AVLTree.md +108 -108
  4. package/docs-site-docusaurus/docs/api/classes/BST.md +101 -101
  5. package/docs-site-docusaurus/docs/api/classes/BinaryIndexedTree.md +13 -13
  6. package/docs-site-docusaurus/docs/api/classes/BinaryTree.md +66 -66
  7. package/docs-site-docusaurus/docs/api/classes/Deque.md +235 -51
  8. package/docs-site-docusaurus/docs/api/classes/DirectedGraph.md +21 -21
  9. package/docs-site-docusaurus/docs/api/classes/DoublyLinkedList.md +231 -67
  10. package/docs-site-docusaurus/docs/api/classes/FibonacciHeap.md +9 -9
  11. package/docs-site-docusaurus/docs/api/classes/FibonacciHeapNode.md +1 -1
  12. package/docs-site-docusaurus/docs/api/classes/HashMap.md +14 -14
  13. package/docs-site-docusaurus/docs/api/classes/Heap.md +117 -34
  14. package/docs-site-docusaurus/docs/api/classes/IterableElementBase.md +83 -13
  15. package/docs-site-docusaurus/docs/api/classes/LinearBase.md +124 -20
  16. package/docs-site-docusaurus/docs/api/classes/LinearLinkedBase.md +140 -32
  17. package/docs-site-docusaurus/docs/api/classes/LinkedHashMap.md +23 -23
  18. package/docs-site-docusaurus/docs/api/classes/LinkedListQueue.md +159 -51
  19. package/docs-site-docusaurus/docs/api/classes/MapGraph.md +20 -20
  20. package/docs-site-docusaurus/docs/api/classes/Matrix.md +23 -23
  21. package/docs-site-docusaurus/docs/api/classes/MaxHeap.md +117 -34
  22. package/docs-site-docusaurus/docs/api/classes/MaxPriorityQueue.md +117 -34
  23. package/docs-site-docusaurus/docs/api/classes/MinHeap.md +117 -34
  24. package/docs-site-docusaurus/docs/api/classes/MinPriorityQueue.md +117 -34
  25. package/docs-site-docusaurus/docs/api/classes/PriorityQueue.md +117 -34
  26. package/docs-site-docusaurus/docs/api/classes/Queue.md +142 -34
  27. package/docs-site-docusaurus/docs/api/classes/RedBlackTree.md +117 -117
  28. package/docs-site-docusaurus/docs/api/classes/SegmentTree.md +8 -8
  29. package/docs-site-docusaurus/docs/api/classes/SinglyLinkedList.md +158 -50
  30. package/docs-site-docusaurus/docs/api/classes/SkipList.md +21 -21
  31. package/docs-site-docusaurus/docs/api/classes/Stack.md +108 -26
  32. package/docs-site-docusaurus/docs/api/classes/TreeMap.md +33 -33
  33. package/docs-site-docusaurus/docs/api/classes/TreeMultiMap.md +75 -39
  34. package/docs-site-docusaurus/docs/api/classes/TreeSet.md +301 -39
  35. package/docs-site-docusaurus/docs/api/classes/Trie.md +110 -28
  36. package/docs-site-docusaurus/docs/api/classes/UndirectedGraph.md +20 -20
  37. package/package.json +45 -46
  38. package/src/common/error.ts +15 -32
  39. package/src/common/index.ts +0 -3
  40. package/src/data-structures/base/iterable-element-base.ts +0 -3
  41. package/src/data-structures/base/linear-base.ts +2 -36
  42. package/src/data-structures/binary-tree/avl-tree.ts +31 -529
  43. package/src/data-structures/binary-tree/binary-indexed-tree.ts +47 -572
  44. package/src/data-structures/binary-tree/binary-tree.ts +326 -1311
  45. package/src/data-structures/binary-tree/bst.ts +158 -1082
  46. package/src/data-structures/binary-tree/red-black-tree.ts +451 -1290
  47. package/src/data-structures/binary-tree/segment-tree.ts +73 -351
  48. package/src/data-structures/binary-tree/tree-map.ts +462 -5124
  49. package/src/data-structures/binary-tree/tree-multi-map.ts +302 -4914
  50. package/src/data-structures/binary-tree/tree-multi-set.ts +284 -3972
  51. package/src/data-structures/binary-tree/tree-set.ts +338 -4836
  52. package/src/data-structures/graph/abstract-graph.ts +98 -167
  53. package/src/data-structures/graph/directed-graph.ts +137 -562
  54. package/src/data-structures/graph/map-graph.ts +0 -3
  55. package/src/data-structures/graph/undirected-graph.ts +132 -511
  56. package/src/data-structures/hash/hash-map.ts +154 -582
  57. package/src/data-structures/heap/heap.ts +200 -795
  58. package/src/data-structures/linked-list/doubly-linked-list.ts +121 -865
  59. package/src/data-structures/linked-list/singly-linked-list.ts +122 -794
  60. package/src/data-structures/linked-list/skip-linked-list.ts +211 -918
  61. package/src/data-structures/matrix/matrix.ts +179 -518
  62. package/src/data-structures/matrix/navigator.ts +0 -1
  63. package/src/data-structures/priority-queue/max-priority-queue.ts +1 -6
  64. package/src/data-structures/priority-queue/min-priority-queue.ts +6 -11
  65. package/src/data-structures/priority-queue/priority-queue.ts +1 -2
  66. package/src/data-structures/queue/deque.ts +214 -882
  67. package/src/data-structures/queue/queue.ts +102 -625
  68. package/src/data-structures/stack/stack.ts +76 -505
  69. package/src/data-structures/trie/trie.ts +98 -628
  70. package/src/types/common.ts +0 -10
  71. package/src/types/data-structures/binary-tree/bst.ts +0 -7
  72. package/src/types/data-structures/binary-tree/red-black-tree.ts +0 -1
  73. package/src/types/data-structures/graph/abstract-graph.ts +0 -2
  74. package/src/types/data-structures/hash/hash-map.ts +0 -3
  75. package/src/types/data-structures/hash/index.ts +0 -1
  76. package/src/types/data-structures/matrix/navigator.ts +0 -2
  77. package/src/types/utils/utils.ts +0 -7
  78. package/src/types/utils/validate-type.ts +0 -7
  79. package/src/utils/number.ts +0 -2
  80. package/src/utils/utils.ts +0 -5
@@ -6,7 +6,7 @@
6
6
 
7
7
  # Abstract Class: LinearLinkedBase\<E, R, NODE\>
8
8
 
9
- Defined in: [data-structures/base/linear-base.ts:402](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L402)
9
+ Defined in: [data-structures/base/linear-base.ts:413](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L413)
10
10
 
11
11
  Linked-list specialized linear container.
12
12
 
@@ -169,7 +169,7 @@ Producing the iterator is O(1); consuming the entire iterator is Time O(n) with
169
169
  abstract addAfter(existingElementOrNode, newElementOrNode): boolean;
170
170
  ```
171
171
 
172
- Defined in: [data-structures/base/linear-base.ts:609](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L609)
172
+ Defined in: [data-structures/base/linear-base.ts:620](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L620)
173
173
 
174
174
  Insert new element/node after an existing node.
175
175
 
@@ -205,7 +205,7 @@ Time O(1)~O(n) depending on reference access, Space O(1)
205
205
  abstract addAt(index, newElementOrNode): boolean;
206
206
  ```
207
207
 
208
- Defined in: [data-structures/base/linear-base.ts:377](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L377)
208
+ Defined in: [data-structures/base/linear-base.ts:388](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L388)
209
209
 
210
210
  Insert an element/node at a position.
211
211
 
@@ -245,7 +245,7 @@ Time O(1)~O(n) depending on implementation, Space O(1)
245
245
  abstract addBefore(existingElementOrNode, newElementOrNode): boolean;
246
246
  ```
247
247
 
248
- Defined in: [data-structures/base/linear-base.ts:600](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L600)
248
+ Defined in: [data-structures/base/linear-base.ts:611](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L611)
249
249
 
250
250
  Insert new element/node before an existing node.
251
251
 
@@ -281,7 +281,7 @@ Time O(1)~O(n) depending on reference access, Space O(1)
281
281
  abstract at(index): E | undefined;
282
282
  ```
283
283
 
284
- Defined in: [data-structures/base/linear-base.ts:360](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L360)
284
+ Defined in: [data-structures/base/linear-base.ts:371](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L371)
285
285
 
286
286
  Get element at an index.
287
287
 
@@ -315,7 +315,7 @@ Time O(1)~O(n) depending on implementation, Space O(1)
315
315
  abstract clear(): void;
316
316
  ```
317
317
 
318
- Defined in: [data-structures/base/iterable-element-base.ts:289](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L289)
318
+ Defined in: [data-structures/base/iterable-element-base.ts:321](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L321)
319
319
 
320
320
  Removes all elements from the structure.
321
321
 
@@ -367,7 +367,7 @@ Time O(n), Space O(n)
367
367
  concat(...items): this;
368
368
  ```
369
369
 
370
- Defined in: [data-structures/base/linear-base.ts:473](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L473)
370
+ Defined in: [data-structures/base/linear-base.ts:484](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L484)
371
371
 
372
372
  Concatenate lists/elements preserving order.
373
373
 
@@ -403,7 +403,7 @@ Time O(sum(length)), Space O(sum(length))
403
403
  abstract delete(elementOrNode): boolean;
404
404
  ```
405
405
 
406
- Defined in: [data-structures/base/linear-base.ts:591](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L591)
406
+ Defined in: [data-structures/base/linear-base.ts:602](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L602)
407
407
 
408
408
  Delete by element or node in a linked list.
409
409
 
@@ -437,7 +437,7 @@ Time O(1)~O(n) depending on availability of links, Space O(1)
437
437
  abstract deleteAt(pos): E | undefined;
438
438
  ```
439
439
 
440
- Defined in: [data-structures/base/linear-base.ts:368](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L368)
440
+ Defined in: [data-structures/base/linear-base.ts:379](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L379)
441
441
 
442
442
  Remove element at a position.
443
443
 
@@ -465,6 +465,30 @@ Time O(1)~O(n) depending on implementation, Space O(1)
465
465
 
466
466
  ***
467
467
 
468
+ ### entries()
469
+
470
+ ```ts
471
+ entries(): IterableIterator<[number, E]>;
472
+ ```
473
+
474
+ Defined in: [data-structures/base/iterable-element-base.ts:208](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L208)
475
+
476
+ Return an iterator of `[index, value]` pairs (Array-compatible).
477
+
478
+ #### Returns
479
+
480
+ `IterableIterator`\<\[`number`, `E`\]\>
481
+
482
+ #### Remarks
483
+
484
+ Provided for familiarity when migrating from Array. Time O(n), Space O(1) per step.
485
+
486
+ #### Inherited from
487
+
488
+ [`LinearBase`](LinearBase.md).[`entries`](LinearBase.md#entries)
489
+
490
+ ***
491
+
468
492
  ### every()
469
493
 
470
494
  ```ts
@@ -560,7 +584,7 @@ Time O(n), Space O(1)
560
584
  abstract filter(predicate, thisArg?): this;
561
585
  ```
562
586
 
563
- Defined in: [data-structures/base/iterable-element-base.ts:341](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L341)
587
+ Defined in: [data-structures/base/iterable-element-base.ts:373](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L373)
564
588
 
565
589
  Filters elements using the provided predicate and returns the same concrete structure type.
566
590
 
@@ -770,7 +794,7 @@ Time O(n), Space O(1).
770
794
  abstract getNodeAt(index): NODE | undefined;
771
795
  ```
772
796
 
773
- Defined in: [data-structures/base/linear-base.ts:617](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L617)
797
+ Defined in: [data-structures/base/linear-base.ts:628](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L628)
774
798
 
775
799
  Node at index (for random-access emulation).
776
800
 
@@ -828,13 +852,47 @@ Time O(n) in the worst case. Space O(1).
828
852
 
829
853
  ***
830
854
 
855
+ ### includes()
856
+
857
+ ```ts
858
+ includes(element): boolean;
859
+ ```
860
+
861
+ Defined in: [data-structures/base/iterable-element-base.ts:200](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L200)
862
+
863
+ Check whether a value exists (Array-compatible alias for `has`).
864
+
865
+ #### Parameters
866
+
867
+ ##### element
868
+
869
+ `E`
870
+
871
+ Element to search for (uses `===`).
872
+
873
+ #### Returns
874
+
875
+ `boolean`
876
+
877
+ `true` if found.
878
+
879
+ #### Remarks
880
+
881
+ Provided for familiarity when migrating from Array. Time O(n), Space O(1).
882
+
883
+ #### Inherited from
884
+
885
+ [`LinearBase`](LinearBase.md).[`includes`](LinearBase.md#includes)
886
+
887
+ ***
888
+
831
889
  ### indexOf()
832
890
 
833
891
  ```ts
834
892
  indexOf(searchElement, fromIndex?): number;
835
893
  ```
836
894
 
837
- Defined in: [data-structures/base/linear-base.ts:422](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L422)
895
+ Defined in: [data-structures/base/linear-base.ts:433](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L433)
838
896
 
839
897
  Linked-list optimized `indexOf` (forwards scan).
840
898
 
@@ -874,7 +932,7 @@ Time O(n), Space O(1)
874
932
  abstract isEmpty(): boolean;
875
933
  ```
876
934
 
877
- Defined in: [data-structures/base/iterable-element-base.ts:280](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L280)
935
+ Defined in: [data-structures/base/iterable-element-base.ts:312](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L312)
878
936
 
879
937
  Indicates whether the structure currently contains no elements.
880
938
 
@@ -928,13 +986,37 @@ Time O(n), Space O(n)
928
986
 
929
987
  ***
930
988
 
989
+ ### keys()
990
+
991
+ ```ts
992
+ keys(): IterableIterator<number>;
993
+ ```
994
+
995
+ Defined in: [data-structures/base/iterable-element-base.ts:219](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L219)
996
+
997
+ Return an iterator of numeric indices (Array-compatible).
998
+
999
+ #### Returns
1000
+
1001
+ `IterableIterator`\<`number`\>
1002
+
1003
+ #### Remarks
1004
+
1005
+ Provided for familiarity when migrating from Array. Time O(n), Space O(1) per step.
1006
+
1007
+ #### Inherited from
1008
+
1009
+ [`LinearBase`](LinearBase.md).[`keys`](LinearBase.md#keys)
1010
+
1011
+ ***
1012
+
931
1013
  ### lastIndexOf()
932
1014
 
933
1015
  ```ts
934
1016
  lastIndexOf(searchElement, fromIndex?): number;
935
1017
  ```
936
1018
 
937
- Defined in: [data-structures/base/linear-base.ts:448](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L448)
1019
+ Defined in: [data-structures/base/linear-base.ts:459](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L459)
938
1020
 
939
1021
  Linked-list optimized `lastIndexOf` (reverse scan).
940
1022
 
@@ -977,7 +1059,7 @@ abstract map<EM, RM>(
977
1059
  thisArg?): IterableElementBase<EM, RM>;
978
1060
  ```
979
1061
 
980
- Defined in: [data-structures/base/iterable-element-base.ts:313](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L313)
1062
+ Defined in: [data-structures/base/iterable-element-base.ts:345](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L345)
981
1063
 
982
1064
  Maps each element to a new element and returns a new iterable structure.
983
1065
 
@@ -1037,7 +1119,7 @@ Time O(n), Space O(n).
1037
1119
  abstract mapSame(callback, thisArg?): this;
1038
1120
  ```
1039
1121
 
1040
- Defined in: [data-structures/base/iterable-element-base.ts:329](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L329)
1122
+ Defined in: [data-structures/base/iterable-element-base.ts:361](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L361)
1041
1123
 
1042
1124
  Maps each element to the same element type and returns the same concrete structure type.
1043
1125
 
@@ -1077,7 +1159,7 @@ Time O(n), Space O(n).
1077
1159
  print(): void;
1078
1160
  ```
1079
1161
 
1080
- Defined in: [data-structures/base/iterable-element-base.ts:269](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L269)
1162
+ Defined in: [data-structures/base/iterable-element-base.ts:301](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L301)
1081
1163
 
1082
1164
  Prints `toVisual()` to the console. Intended for quick debugging.
1083
1165
 
@@ -1103,7 +1185,7 @@ Time O(n) due to materialization, Space O(n) for the intermediate representation
1103
1185
  abstract push(elementOrNode): boolean;
1104
1186
  ```
1105
1187
 
1106
- Defined in: [data-structures/base/linear-base.ts:336](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L336)
1188
+ Defined in: [data-structures/base/linear-base.ts:347](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L347)
1107
1189
 
1108
1190
  Append one element or node to the tail.
1109
1191
 
@@ -1137,7 +1219,7 @@ Time O(1) amortized typical, Space O(1)
1137
1219
  abstract pushMany(elements): boolean[];
1138
1220
  ```
1139
1221
 
1140
- Defined in: [data-structures/base/linear-base.ts:344](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L344)
1222
+ Defined in: [data-structures/base/linear-base.ts:355](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L355)
1141
1223
 
1142
1224
  Append many elements/nodes at once.
1143
1225
 
@@ -1205,7 +1287,7 @@ Time O(n), Space O(1). Throws if called on an empty structure without `initialVa
1205
1287
  reduce(callbackfn): E;
1206
1288
  ```
1207
1289
 
1208
- Defined in: [data-structures/base/iterable-element-base.ts:194](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L194)
1290
+ Defined in: [data-structures/base/iterable-element-base.ts:226](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L226)
1209
1291
 
1210
1292
  ##### Parameters
1211
1293
 
@@ -1227,7 +1309,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:194](https://github.c
1227
1309
  reduce(callbackfn, initialValue): E;
1228
1310
  ```
1229
1311
 
1230
- Defined in: [data-structures/base/iterable-element-base.ts:195](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L195)
1312
+ Defined in: [data-structures/base/iterable-element-base.ts:227](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L227)
1231
1313
 
1232
1314
  ##### Parameters
1233
1315
 
@@ -1253,7 +1335,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:195](https://github.c
1253
1335
  reduce<U>(callbackfn, initialValue): U;
1254
1336
  ```
1255
1337
 
1256
- Defined in: [data-structures/base/iterable-element-base.ts:196](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L196)
1338
+ Defined in: [data-structures/base/iterable-element-base.ts:228](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L228)
1257
1339
 
1258
1340
  ##### Type Parameters
1259
1341
 
@@ -1287,7 +1369,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:196](https://github.c
1287
1369
  reduceRight<U>(callbackfn, initialValue): U;
1288
1370
  ```
1289
1371
 
1290
- Defined in: [data-structures/base/linear-base.ts:574](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L574)
1372
+ Defined in: [data-structures/base/linear-base.ts:585](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L585)
1291
1373
 
1292
1374
  Right-to-left reduction using reverse iterator.
1293
1375
 
@@ -1399,7 +1481,7 @@ Time O(1) typical, Space O(1)
1399
1481
  slice(start?, end?): this;
1400
1482
  ```
1401
1483
 
1402
- Defined in: [data-structures/base/linear-base.ts:494](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L494)
1484
+ Defined in: [data-structures/base/linear-base.ts:505](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L505)
1403
1485
 
1404
1486
  Slice via forward iteration (no random access required).
1405
1487
 
@@ -1516,7 +1598,7 @@ splice(
1516
1598
  items): this;
1517
1599
  ```
1518
1600
 
1519
- Defined in: [data-structures/base/linear-base.ts:522](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L522)
1601
+ Defined in: [data-structures/base/linear-base.ts:533](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L533)
1520
1602
 
1521
1603
  Splice by walking node iterators from the start index.
1522
1604
 
@@ -1562,7 +1644,7 @@ Time O(n + m), Space O(min(n, m)) where `m = items.length`
1562
1644
  toArray(): E[];
1563
1645
  ```
1564
1646
 
1565
- Defined in: [data-structures/base/iterable-element-base.ts:246](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L246)
1647
+ Defined in: [data-structures/base/iterable-element-base.ts:278](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L278)
1566
1648
 
1567
1649
  Materializes the elements into a new array.
1568
1650
 
@@ -1582,6 +1664,32 @@ Time O(n), Space O(n).
1582
1664
 
1583
1665
  ***
1584
1666
 
1667
+ ### toReversed()
1668
+
1669
+ ```ts
1670
+ toReversed(): this;
1671
+ ```
1672
+
1673
+ Defined in: [data-structures/base/linear-base.ts:335](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L335)
1674
+
1675
+ Return a new instance of the same type with elements in reverse order (non-mutating).
1676
+
1677
+ #### Returns
1678
+
1679
+ `this`
1680
+
1681
+ A new reversed instance.
1682
+
1683
+ #### Remarks
1684
+
1685
+ Provided for familiarity when migrating from Array (ES2023 `toReversed`). Time O(n), Space O(n).
1686
+
1687
+ #### Inherited from
1688
+
1689
+ [`LinearBase`](LinearBase.md).[`toReversed`](LinearBase.md#toreversed)
1690
+
1691
+ ***
1692
+
1585
1693
  ### toReversedArray()
1586
1694
 
1587
1695
  ```ts
@@ -1614,7 +1722,7 @@ Time O(n), Space O(n)
1614
1722
  toVisual(): E[];
1615
1723
  ```
1616
1724
 
1617
- Defined in: [data-structures/base/iterable-element-base.ts:258](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L258)
1725
+ Defined in: [data-structures/base/iterable-element-base.ts:290](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L290)
1618
1726
 
1619
1727
  Returns a representation of the structure suitable for quick visualization.
1620
1728
  Defaults to an array of elements; subclasses may override to provide richer visuals.
@@ -1700,7 +1808,7 @@ Time O(1), Space O(1).
1700
1808
  abstract protected _createInstance(options?): this;
1701
1809
  ```
1702
1810
 
1703
- Defined in: [data-structures/base/linear-base.ts:385](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L385)
1811
+ Defined in: [data-structures/base/linear-base.ts:396](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L396)
1704
1812
 
1705
1813
  Create an empty list of the same species.
1706
1814
 
@@ -1734,7 +1842,7 @@ Time O(1), Space O(1)
1734
1842
  abstract protected _getIterator(...args): IterableIterator<E>;
1735
1843
  ```
1736
1844
 
1737
- Defined in: [data-structures/base/iterable-element-base.ts:352](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L352)
1845
+ Defined in: [data-structures/base/iterable-element-base.ts:384](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L384)
1738
1846
 
1739
1847
  Internal iterator factory used by the default iterator.
1740
1848
 
@@ -1768,7 +1876,7 @@ Implementations should yield in O(1) per element with O(1) extra space when poss
1768
1876
  abstract protected _getNodeIterator(...args): IterableIterator<NODE>;
1769
1877
  ```
1770
1878
 
1771
- Defined in: [data-structures/base/linear-base.ts:624](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L624)
1879
+ Defined in: [data-structures/base/linear-base.ts:635](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L635)
1772
1880
 
1773
1881
  Iterate linked nodes from head to tail.
1774
1882
 
@@ -1796,7 +1904,7 @@ Time O(n), Space O(1)
1796
1904
  abstract protected _getPrevNode(node): NODE | undefined;
1797
1905
  ```
1798
1906
 
1799
- Defined in: [data-structures/base/linear-base.ts:632](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L632)
1907
+ Defined in: [data-structures/base/linear-base.ts:643](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L643)
1800
1908
 
1801
1909
  Get previous node of a given node.
1802
1910
 
@@ -1826,7 +1934,7 @@ Time O(1)~O(n) depending on list variant (singly vs doubly), Space O(1)
1826
1934
  abstract protected _getReverseIterator(...args): IterableIterator<E>;
1827
1935
  ```
1828
1936
 
1829
- Defined in: [data-structures/base/linear-base.ts:392](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L392)
1937
+ Defined in: [data-structures/base/linear-base.ts:403](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L403)
1830
1938
 
1831
1939
  Reverse-direction iterator over elements.
1832
1940
 
@@ -6,7 +6,7 @@
6
6
 
7
7
  # Class: LinkedHashMap\<K, V, R\>
8
8
 
9
- Defined in: [data-structures/hash/hash-map.ts:920](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/hash/hash-map.ts#L920)
9
+ Defined in: [data-structures/hash/hash-map.ts:953](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/hash/hash-map.ts#L953)
10
10
 
11
11
  Hash-based map that preserves insertion order via a doubly-linked list.
12
12
 
@@ -46,7 +46,7 @@ examples will be generated by unit test
46
46
  new LinkedHashMap<K, V, R>(entryOrRawElements?, options?): LinkedHashMap<K, V, R>;
47
47
  ```
48
48
 
49
- Defined in: [data-structures/hash/hash-map.ts:930](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/hash/hash-map.ts#L930)
49
+ Defined in: [data-structures/hash/hash-map.ts:963](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/hash/hash-map.ts#L963)
50
50
 
51
51
  Create a LinkedHashMap and optionally bulk-insert entries.
52
52
 
@@ -90,7 +90,7 @@ IterableEntryBase<K, V>.constructor
90
90
  get first(): [K, V] | undefined;
91
91
  ```
92
92
 
93
- Defined in: [data-structures/hash/hash-map.ts:1020](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/hash/hash-map.ts#L1020)
93
+ Defined in: [data-structures/hash/hash-map.ts:1053](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/hash/hash-map.ts#L1053)
94
94
 
95
95
  Get the first [key, value] pair.
96
96
 
@@ -114,7 +114,7 @@ First entry or undefined when empty.
114
114
  get head(): HashMapLinkedNode<K, V | undefined>;
115
115
  ```
116
116
 
117
- Defined in: [data-structures/hash/hash-map.ts:984](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/hash/hash-map.ts#L984)
117
+ Defined in: [data-structures/hash/hash-map.ts:1017](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/hash/hash-map.ts#L1017)
118
118
 
119
119
  Get the head node (first entry) sentinel link.
120
120
 
@@ -138,7 +138,7 @@ Head node or sentinel.
138
138
  get last(): [K, V] | undefined;
139
139
  ```
140
140
 
141
- Defined in: [data-structures/hash/hash-map.ts:1030](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/hash/hash-map.ts#L1030)
141
+ Defined in: [data-structures/hash/hash-map.ts:1063](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/hash/hash-map.ts#L1063)
142
142
 
143
143
  Get the last [key, value] pair.
144
144
 
@@ -162,7 +162,7 @@ Last entry or undefined when empty.
162
162
  get noObjMap(): Record<string, HashMapLinkedNode<K, V | undefined>>;
163
163
  ```
164
164
 
165
- Defined in: [data-structures/hash/hash-map.ts:968](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/hash/hash-map.ts#L968)
165
+ Defined in: [data-structures/hash/hash-map.ts:1001](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/hash/hash-map.ts#L1001)
166
166
 
167
167
  Get the internal record for non-object keys.
168
168
 
@@ -186,7 +186,7 @@ Record of hash→node.
186
186
  get objHashFn(): (key) => object;
187
187
  ```
188
188
 
189
- Defined in: [data-structures/hash/hash-map.ts:957](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/hash/hash-map.ts#L957)
189
+ Defined in: [data-structures/hash/hash-map.ts:990](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/hash/hash-map.ts#L990)
190
190
 
191
191
  Get the hash function for object/weak keys.
192
192
 
@@ -210,7 +210,7 @@ Object-hash function.
210
210
  get size(): number;
211
211
  ```
212
212
 
213
- Defined in: [data-structures/hash/hash-map.ts:1011](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/hash/hash-map.ts#L1011)
213
+ Defined in: [data-structures/hash/hash-map.ts:1044](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/hash/hash-map.ts#L1044)
214
214
 
215
215
  Total number of entries.
216
216
 
@@ -238,7 +238,7 @@ Entry count.
238
238
  get tail(): HashMapLinkedNode<K, V | undefined>;
239
239
  ```
240
240
 
241
- Defined in: [data-structures/hash/hash-map.ts:995](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/hash/hash-map.ts#L995)
241
+ Defined in: [data-structures/hash/hash-map.ts:1028](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/hash/hash-map.ts#L1028)
242
242
 
243
243
  Get the tail node (last entry) sentinel link.
244
244
 
@@ -292,7 +292,7 @@ Time O(n) to iterate, Space O(1)
292
292
  at(index): V | undefined;
293
293
  ```
294
294
 
295
- Defined in: [data-structures/hash/hash-map.ts:1148](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/hash/hash-map.ts#L1148)
295
+ Defined in: [data-structures/hash/hash-map.ts:1181](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/hash/hash-map.ts#L1181)
296
296
 
297
297
  Get the value at a given index in insertion order.
298
298
 
@@ -322,7 +322,7 @@ Time O(N), Space O(1)
322
322
  begin(): Generator<(K | V | undefined)[], void, unknown>;
323
323
  ```
324
324
 
325
- Defined in: [data-structures/hash/hash-map.ts:1040](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/hash/hash-map.ts#L1040)
325
+ Defined in: [data-structures/hash/hash-map.ts:1073](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/hash/hash-map.ts#L1073)
326
326
 
327
327
  Iterate from head → tail.
328
328
 
@@ -344,7 +344,7 @@ Time O(N), Space O(1)
344
344
  clear(): void;
345
345
  ```
346
346
 
347
- Defined in: [data-structures/hash/hash-map.ts:1221](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/hash/hash-map.ts#L1221)
347
+ Defined in: [data-structures/hash/hash-map.ts:1254](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/hash/hash-map.ts#L1254)
348
348
 
349
349
  Remove all entries.
350
350
 
@@ -368,7 +368,7 @@ Time O(n) typical, Space O(1)
368
368
  clone(): this;
369
369
  ```
370
370
 
371
- Defined in: [data-structures/hash/hash-map.ts:1227](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/hash/hash-map.ts#L1227)
371
+ Defined in: [data-structures/hash/hash-map.ts:1260](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/hash/hash-map.ts#L1260)
372
372
 
373
373
  Deep clone preserving the concrete subtype.
374
374
 
@@ -394,7 +394,7 @@ Time O(n) typical, Space O(n)
394
394
  deleteAt(index): [K, V | undefined];
395
395
  ```
396
396
 
397
- Defined in: [data-structures/hash/hash-map.ts:1204](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/hash/hash-map.ts#L1204)
397
+ Defined in: [data-structures/hash/hash-map.ts:1237](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/hash/hash-map.ts#L1237)
398
398
 
399
399
  Delete the entry at a given index.
400
400
 
@@ -428,7 +428,7 @@ If index is out of bounds.
428
428
  deleteWhere(predicate): boolean;
429
429
  ```
430
430
 
431
- Defined in: [data-structures/hash/hash-map.ts:1177](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/hash/hash-map.ts#L1177)
431
+ Defined in: [data-structures/hash/hash-map.ts:1210](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/hash/hash-map.ts#L1210)
432
432
 
433
433
  Delete the first entry that matches a predicate.
434
434
 
@@ -524,7 +524,7 @@ Time O(n), Space O(1)
524
524
  filter(predicate, thisArg?): this;
525
525
  ```
526
526
 
527
- Defined in: [data-structures/hash/hash-map.ts:1232](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/hash/hash-map.ts#L1232)
527
+ Defined in: [data-structures/hash/hash-map.ts:1265](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/hash/hash-map.ts#L1265)
528
528
 
529
529
  Filter entries and return the same-species structure.
530
530
 
@@ -638,7 +638,7 @@ Time O(n), Space O(1)
638
638
  get(key): V | undefined;
639
639
  ```
640
640
 
641
- Defined in: [data-structures/hash/hash-map.ts:1131](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/hash/hash-map.ts#L1131)
641
+ Defined in: [data-structures/hash/hash-map.ts:1164](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/hash/hash-map.ts#L1164)
642
642
 
643
643
  Get the value under a key.
644
644
 
@@ -672,7 +672,7 @@ Time O(n) generic, Space O(1)
672
672
  has(key): boolean;
673
673
  ```
674
674
 
675
- Defined in: [data-structures/hash/hash-map.ts:1122](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/hash/hash-map.ts#L1122)
675
+ Defined in: [data-structures/hash/hash-map.ts:1155](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/hash/hash-map.ts#L1155)
676
676
 
677
677
  Whether the given key exists.
678
678
 
@@ -740,7 +740,7 @@ Time O(n), Space O(1)
740
740
  isEmpty(): boolean;
741
741
  ```
742
742
 
743
- Defined in: [data-structures/hash/hash-map.ts:1213](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/hash/hash-map.ts#L1213)
743
+ Defined in: [data-structures/hash/hash-map.ts:1246](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/hash/hash-map.ts#L1246)
744
744
 
745
745
  Whether there are no entries.
746
746
 
@@ -792,7 +792,7 @@ Time O(n), Space O(1)
792
792
  map<MK, MV>(callback, thisArg?): LinkedHashMap<MK, MV>;
793
793
  ```
794
794
 
795
- Defined in: [data-structures/hash/hash-map.ts:1251](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/hash/hash-map.ts#L1251)
795
+ Defined in: [data-structures/hash/hash-map.ts:1284](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/hash/hash-map.ts#L1284)
796
796
 
797
797
  Map each entry to a new [key, value] pair and preserve order.
798
798
 
@@ -912,7 +912,7 @@ Time O(n), Space O(1)
912
912
  reverseBegin(): Generator<(K | V | undefined)[], void, unknown>;
913
913
  ```
914
914
 
915
- Defined in: [data-structures/hash/hash-map.ts:1053](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/hash/hash-map.ts#L1053)
915
+ Defined in: [data-structures/hash/hash-map.ts:1086](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/hash/hash-map.ts#L1086)
916
916
 
917
917
  Iterate from tail → head.
918
918
 
@@ -934,7 +934,7 @@ Time O(N), Space O(1)
934
934
  set(key, value?): this;
935
935
  ```
936
936
 
937
- Defined in: [data-structures/hash/hash-map.ts:1068](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/hash/hash-map.ts#L1068)
937
+ Defined in: [data-structures/hash/hash-map.ts:1101](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/hash/hash-map.ts#L1101)
938
938
 
939
939
  Insert or replace a single entry; preserves insertion order.
940
940
 
@@ -1091,7 +1091,7 @@ Time O(n), Space O(1)
1091
1091
  protected _getIterator(): IterableIterator<[K, V]>;
1092
1092
  ```
1093
1093
 
1094
- Defined in: [data-structures/hash/hash-map.ts:1262](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/hash/hash-map.ts#L1262)
1094
+ Defined in: [data-structures/hash/hash-map.ts:1295](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/hash/hash-map.ts#L1295)
1095
1095
 
1096
1096
  Underlying iterator for the default iteration protocol.
1097
1097