data-structure-typed 2.6.0 → 2.6.2

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 (160) hide show
  1. package/.github/workflows/ci.yml +7 -2
  2. package/.github/workflows/release-package.yml +9 -2
  3. package/CHANGELOG.md +9 -1
  4. package/dist/cjs/binary-tree.cjs +2927 -23688
  5. package/dist/cjs/graph.cjs +845 -2634
  6. package/dist/cjs/hash.cjs +185 -616
  7. package/dist/cjs/heap.cjs +266 -818
  8. package/dist/cjs/index.cjs +5116 -31358
  9. package/dist/cjs/linked-list.cjs +644 -2615
  10. package/dist/cjs/matrix.cjs +220 -535
  11. package/dist/cjs/priority-queue.cjs +266 -818
  12. package/dist/cjs/queue.cjs +637 -2343
  13. package/dist/cjs/stack.cjs +124 -530
  14. package/dist/cjs/trie.cjs +145 -592
  15. package/dist/cjs-legacy/binary-tree.cjs +4352 -25113
  16. package/dist/cjs-legacy/graph.cjs +847 -2636
  17. package/dist/cjs-legacy/hash.cjs +181 -612
  18. package/dist/cjs-legacy/heap.cjs +266 -818
  19. package/dist/cjs-legacy/index.cjs +6657 -32899
  20. package/dist/cjs-legacy/linked-list.cjs +640 -2611
  21. package/dist/cjs-legacy/matrix.cjs +220 -535
  22. package/dist/cjs-legacy/priority-queue.cjs +266 -818
  23. package/dist/cjs-legacy/queue.cjs +634 -2340
  24. package/dist/cjs-legacy/stack.cjs +124 -530
  25. package/dist/cjs-legacy/trie.cjs +145 -592
  26. package/dist/esm/binary-tree.mjs +2927 -23688
  27. package/dist/esm/graph.mjs +845 -2634
  28. package/dist/esm/hash.mjs +185 -616
  29. package/dist/esm/heap.mjs +266 -818
  30. package/dist/esm/index.mjs +5116 -31358
  31. package/dist/esm/linked-list.mjs +644 -2615
  32. package/dist/esm/matrix.mjs +220 -535
  33. package/dist/esm/priority-queue.mjs +266 -818
  34. package/dist/esm/queue.mjs +637 -2343
  35. package/dist/esm/stack.mjs +124 -530
  36. package/dist/esm/trie.mjs +145 -592
  37. package/dist/esm-legacy/binary-tree.mjs +4352 -25113
  38. package/dist/esm-legacy/graph.mjs +847 -2636
  39. package/dist/esm-legacy/hash.mjs +181 -612
  40. package/dist/esm-legacy/heap.mjs +266 -818
  41. package/dist/esm-legacy/index.mjs +6657 -32899
  42. package/dist/esm-legacy/linked-list.mjs +640 -2611
  43. package/dist/esm-legacy/matrix.mjs +220 -535
  44. package/dist/esm-legacy/priority-queue.mjs +266 -818
  45. package/dist/esm-legacy/queue.mjs +634 -2340
  46. package/dist/esm-legacy/stack.mjs +124 -530
  47. package/dist/esm-legacy/trie.mjs +145 -592
  48. package/dist/types/data-structures/binary-tree/avl-tree.d.ts +29 -500
  49. package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +38 -563
  50. package/dist/types/data-structures/binary-tree/binary-tree.d.ts +230 -1212
  51. package/dist/types/data-structures/binary-tree/bst.d.ts +124 -1063
  52. package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +99 -854
  53. package/dist/types/data-structures/binary-tree/segment-tree.d.ts +62 -314
  54. package/dist/types/data-structures/binary-tree/tree-map.d.ts +366 -5057
  55. package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +277 -4885
  56. package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +253 -3929
  57. package/dist/types/data-structures/binary-tree/tree-set.d.ts +261 -4782
  58. package/dist/types/data-structures/graph/abstract-graph.d.ts +44 -44
  59. package/dist/types/data-structures/graph/directed-graph.d.ts +130 -527
  60. package/dist/types/data-structures/graph/undirected-graph.d.ts +125 -482
  61. package/dist/types/data-structures/hash/hash-map.d.ts +132 -562
  62. package/dist/types/data-structures/heap/heap.d.ts +194 -746
  63. package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +120 -809
  64. package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +121 -733
  65. package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +193 -863
  66. package/dist/types/data-structures/matrix/matrix.d.ts +159 -474
  67. package/dist/types/data-structures/priority-queue/max-priority-queue.d.ts +1 -6
  68. package/dist/types/data-structures/priority-queue/min-priority-queue.d.ts +6 -11
  69. package/dist/types/data-structures/priority-queue/priority-queue.d.ts +1 -1
  70. package/dist/types/data-structures/queue/deque.d.ts +196 -804
  71. package/dist/types/data-structures/queue/queue.d.ts +99 -585
  72. package/dist/types/data-structures/stack/stack.d.ts +75 -481
  73. package/dist/types/data-structures/trie/trie.d.ts +98 -584
  74. package/dist/umd/data-structure-typed.js +6580 -32822
  75. package/dist/umd/data-structure-typed.min.js +3 -3
  76. package/docs-site-docusaurus/docs/api/classes/AVLTree.md +162 -215
  77. package/docs-site-docusaurus/docs/api/classes/AVLTreeNode.md +9 -9
  78. package/docs-site-docusaurus/docs/api/classes/AbstractGraph.md +47 -47
  79. package/docs-site-docusaurus/docs/api/classes/BST.md +155 -208
  80. package/docs-site-docusaurus/docs/api/classes/BSTNode.md +7 -7
  81. package/docs-site-docusaurus/docs/api/classes/BinaryIndexedTree.md +13 -29
  82. package/docs-site-docusaurus/docs/api/classes/BinaryTree.md +104 -158
  83. package/docs-site-docusaurus/docs/api/classes/BinaryTreeNode.md +13 -13
  84. package/docs-site-docusaurus/docs/api/classes/Deque.md +253 -101
  85. package/docs-site-docusaurus/docs/api/classes/DirectedGraph.md +60 -80
  86. package/docs-site-docusaurus/docs/api/classes/DoublyLinkedList.md +244 -114
  87. package/docs-site-docusaurus/docs/api/classes/DoublyLinkedListNode.md +6 -6
  88. package/docs-site-docusaurus/docs/api/classes/FibonacciHeap.md +9 -9
  89. package/docs-site-docusaurus/docs/api/classes/FibonacciHeapNode.md +1 -1
  90. package/docs-site-docusaurus/docs/api/classes/HashMap.md +52 -48
  91. package/docs-site-docusaurus/docs/api/classes/Heap.md +119 -64
  92. package/docs-site-docusaurus/docs/api/classes/IterableElementBase.md +84 -14
  93. package/docs-site-docusaurus/docs/api/classes/LinearBase.md +138 -34
  94. package/docs-site-docusaurus/docs/api/classes/LinearLinkedBase.md +149 -41
  95. package/docs-site-docusaurus/docs/api/classes/LinkedHashMap.md +23 -23
  96. package/docs-site-docusaurus/docs/api/classes/LinkedListQueue.md +172 -92
  97. package/docs-site-docusaurus/docs/api/classes/MapGraph.md +60 -80
  98. package/docs-site-docusaurus/docs/api/classes/Matrix.md +57 -52
  99. package/docs-site-docusaurus/docs/api/classes/MaxHeap.md +117 -62
  100. package/docs-site-docusaurus/docs/api/classes/MaxPriorityQueue.md +120 -70
  101. package/docs-site-docusaurus/docs/api/classes/MinHeap.md +117 -62
  102. package/docs-site-docusaurus/docs/api/classes/MinPriorityQueue.md +125 -75
  103. package/docs-site-docusaurus/docs/api/classes/PriorityQueue.md +119 -64
  104. package/docs-site-docusaurus/docs/api/classes/Queue.md +158 -74
  105. package/docs-site-docusaurus/docs/api/classes/RedBlackTree.md +171 -225
  106. package/docs-site-docusaurus/docs/api/classes/SegmentTree.md +10 -22
  107. package/docs-site-docusaurus/docs/api/classes/SinglyLinkedList.md +172 -94
  108. package/docs-site-docusaurus/docs/api/classes/SinglyLinkedListNode.md +4 -4
  109. package/docs-site-docusaurus/docs/api/classes/SkipList.md +98 -75
  110. package/docs-site-docusaurus/docs/api/classes/Stack.md +112 -50
  111. package/docs-site-docusaurus/docs/api/classes/TreeMap.md +104 -129
  112. package/docs-site-docusaurus/docs/api/classes/TreeMultiMap.md +90 -121
  113. package/docs-site-docusaurus/docs/api/classes/TreeSet.md +298 -107
  114. package/docs-site-docusaurus/docs/api/classes/Trie.md +116 -58
  115. package/docs-site-docusaurus/docs/api/classes/TrieNode.md +8 -8
  116. package/docs-site-docusaurus/docs/api/classes/UndirectedGraph.md +59 -77
  117. package/package.json +45 -46
  118. package/src/common/error.ts +15 -32
  119. package/src/common/index.ts +0 -3
  120. package/src/data-structures/base/iterable-element-base.ts +0 -3
  121. package/src/data-structures/base/linear-base.ts +2 -36
  122. package/src/data-structures/binary-tree/avl-tree.ts +31 -529
  123. package/src/data-structures/binary-tree/binary-indexed-tree.ts +47 -572
  124. package/src/data-structures/binary-tree/binary-tree.ts +326 -1311
  125. package/src/data-structures/binary-tree/bst.ts +158 -1082
  126. package/src/data-structures/binary-tree/red-black-tree.ts +451 -1290
  127. package/src/data-structures/binary-tree/segment-tree.ts +73 -351
  128. package/src/data-structures/binary-tree/tree-map.ts +462 -5124
  129. package/src/data-structures/binary-tree/tree-multi-map.ts +302 -4914
  130. package/src/data-structures/binary-tree/tree-multi-set.ts +299 -3983
  131. package/src/data-structures/binary-tree/tree-set.ts +338 -4836
  132. package/src/data-structures/graph/abstract-graph.ts +98 -167
  133. package/src/data-structures/graph/directed-graph.ts +137 -562
  134. package/src/data-structures/graph/map-graph.ts +0 -3
  135. package/src/data-structures/graph/undirected-graph.ts +132 -511
  136. package/src/data-structures/hash/hash-map.ts +154 -582
  137. package/src/data-structures/heap/heap.ts +200 -795
  138. package/src/data-structures/linked-list/doubly-linked-list.ts +121 -865
  139. package/src/data-structures/linked-list/singly-linked-list.ts +122 -794
  140. package/src/data-structures/linked-list/skip-linked-list.ts +211 -918
  141. package/src/data-structures/matrix/matrix.ts +179 -518
  142. package/src/data-structures/matrix/navigator.ts +0 -1
  143. package/src/data-structures/priority-queue/max-priority-queue.ts +1 -6
  144. package/src/data-structures/priority-queue/min-priority-queue.ts +6 -11
  145. package/src/data-structures/priority-queue/priority-queue.ts +1 -2
  146. package/src/data-structures/queue/deque.ts +214 -882
  147. package/src/data-structures/queue/queue.ts +102 -625
  148. package/src/data-structures/stack/stack.ts +76 -505
  149. package/src/data-structures/trie/trie.ts +98 -628
  150. package/src/types/common.ts +0 -10
  151. package/src/types/data-structures/binary-tree/bst.ts +0 -7
  152. package/src/types/data-structures/binary-tree/red-black-tree.ts +0 -1
  153. package/src/types/data-structures/graph/abstract-graph.ts +0 -2
  154. package/src/types/data-structures/hash/hash-map.ts +0 -3
  155. package/src/types/data-structures/hash/index.ts +0 -1
  156. package/src/types/data-structures/matrix/navigator.ts +0 -2
  157. package/src/types/utils/utils.ts +0 -7
  158. package/src/types/utils/validate-type.ts +0 -7
  159. package/src/utils/number.ts +0 -2
  160. package/src/utils/utils.ts +0 -5
@@ -6,7 +6,7 @@
6
6
 
7
7
  # Class: Trie\<R\>
8
8
 
9
- Defined in: [data-structures/trie/trie.ts:216](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L216)
9
+ Defined in: [data-structures/trie/trie.ts:208](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L208)
10
10
 
11
11
  Prefix tree (Trie) for fast prefix queries and word storage.
12
12
 
@@ -156,7 +156,7 @@ Time O(1), Space O(1)
156
156
  new Trie<R>(words?, options?): Trie<R>;
157
157
  ```
158
158
 
159
- Defined in: [data-structures/trie/trie.ts:225](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L225)
159
+ Defined in: [data-structures/trie/trie.ts:216](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L216)
160
160
 
161
161
  Create a Trie and optionally bulk-insert words.
162
162
 
@@ -198,7 +198,7 @@ Time O(totalChars), Space O(totalChars)
198
198
  get caseSensitive(): boolean;
199
199
  ```
200
200
 
201
- Defined in: [data-structures/trie/trie.ts:256](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L256)
201
+ Defined in: [data-structures/trie/trie.ts:245](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L245)
202
202
 
203
203
  Get whether comparisons are case-sensitive.
204
204
 
@@ -222,7 +222,7 @@ True if case-sensitive.
222
222
  get root(): TrieNode;
223
223
  ```
224
224
 
225
- Defined in: [data-structures/trie/trie.ts:268](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L268)
225
+ Defined in: [data-structures/trie/trie.ts:256](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L256)
226
226
 
227
227
  Get the root node.
228
228
 
@@ -246,7 +246,7 @@ Root TrieNode.
246
246
  get size(): number;
247
247
  ```
248
248
 
249
- Defined in: [data-structures/trie/trie.ts:244](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L244)
249
+ Defined in: [data-structures/trie/trie.ts:234](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L234)
250
250
 
251
251
  Get the number of stored words.
252
252
 
@@ -330,7 +330,7 @@ Producing the iterator is O(1); consuming the entire iterator is Time O(n) with
330
330
  add(word): boolean;
331
331
  ```
332
332
 
333
- Defined in: [data-structures/trie/trie.ts:343](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L343)
333
+ Defined in: [data-structures/trie/trie.ts:290](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L290)
334
334
 
335
335
  Insert one word into the trie.
336
336
 
@@ -348,8 +348,6 @@ Word to insert.
348
348
 
349
349
  True if the word was newly added.
350
350
 
351
- *
352
-
353
351
  #### Remarks
354
352
 
355
353
  Time O(L), Space O(L)
@@ -381,7 +379,7 @@ Time O(L), Space O(L)
381
379
  addMany(words): boolean[];
382
380
  ```
383
381
 
384
- Defined in: [data-structures/trie/trie.ts:413](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L413)
382
+ Defined in: [data-structures/trie/trie.ts:323](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L323)
385
383
 
386
384
  Insert many words from an iterable.
387
385
 
@@ -399,8 +397,6 @@ Iterable of strings (or raw records if toElementFn is provided).
399
397
 
400
398
  Array of per-word 'added' flags.
401
399
 
402
- *
403
-
404
400
  #### Remarks
405
401
 
406
402
  Time O(ΣL), Space O(ΣL)
@@ -424,7 +420,7 @@ Time O(ΣL), Space O(ΣL)
424
420
  clear(): void;
425
421
  ```
426
422
 
427
- Defined in: [data-structures/trie/trie.ts:588](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L588)
423
+ Defined in: [data-structures/trie/trie.ts:384](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L384)
428
424
 
429
425
  Remove all words and reset to a fresh root.
430
426
 
@@ -434,8 +430,6 @@ Remove all words and reset to a fresh root.
434
430
 
435
431
  void
436
432
 
437
- *
438
-
439
433
  #### Remarks
440
434
 
441
435
  Time O(1), Space O(1)
@@ -461,7 +455,7 @@ Time O(1), Space O(1)
461
455
  clone(): this;
462
456
  ```
463
457
 
464
- Defined in: [data-structures/trie/trie.ts:1025](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L1025)
458
+ Defined in: [data-structures/trie/trie.ts:615](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L615)
465
459
 
466
460
  Deep clone this trie by iterating and inserting all words.
467
461
 
@@ -471,8 +465,6 @@ Deep clone this trie by iterating and inserting all words.
471
465
 
472
466
  A new trie with the same words and options.
473
467
 
474
- *
475
-
476
468
  #### Remarks
477
469
 
478
470
  Time O(ΣL), Space O(ΣL)
@@ -499,7 +491,7 @@ Time O(ΣL), Space O(ΣL)
499
491
  delete(word): boolean;
500
492
  ```
501
493
 
502
- Defined in: [data-structures/trie/trie.ts:656](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L656)
494
+ Defined in: [data-structures/trie/trie.ts:412](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L412)
503
495
 
504
496
  Delete one word if present.
505
497
 
@@ -517,8 +509,6 @@ Word to delete.
517
509
 
518
510
  True if a word was removed.
519
511
 
520
- *
521
-
522
512
  #### Remarks
523
513
 
524
514
  Time O(L), Space O(1)
@@ -546,6 +536,30 @@ Time O(L), Space O(1)
546
536
 
547
537
  ***
548
538
 
539
+ ### entries()
540
+
541
+ ```ts
542
+ entries(): IterableIterator<[number, string]>;
543
+ ```
544
+
545
+ Defined in: [data-structures/base/iterable-element-base.ts:207](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L207)
546
+
547
+ Return an iterator of `[index, value]` pairs (Array-compatible).
548
+
549
+ #### Returns
550
+
551
+ `IterableIterator`\<\[`number`, `string`\]\>
552
+
553
+ #### Remarks
554
+
555
+ Provided for familiarity when migrating from Array. Time O(n), Space O(1) per step.
556
+
557
+ #### Inherited from
558
+
559
+ [`IterableElementBase`](IterableElementBase.md).[`entries`](IterableElementBase.md#entries)
560
+
561
+ ***
562
+
549
563
  ### every()
550
564
 
551
565
  ```ts
@@ -592,7 +606,7 @@ Time O(n) in the worst case; may exit early when the first failure is found. Spa
592
606
  filter(predicate, thisArg?): this;
593
607
  ```
594
608
 
595
- Defined in: [data-structures/trie/trie.ts:1080](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L1080)
609
+ Defined in: [data-structures/trie/trie.ts:633](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L633)
596
610
 
597
611
  Filter words into a new trie of the same class.
598
612
 
@@ -616,8 +630,6 @@ Value for `this` inside the predicate.
616
630
 
617
631
  A new trie containing words that satisfy the predicate.
618
632
 
619
- *
620
-
621
633
  #### Remarks
622
634
 
623
635
  Time O(ΣL), Space O(ΣL)
@@ -773,7 +785,7 @@ Time O(n), Space O(1).
773
785
  getHeight(): number;
774
786
  ```
775
787
 
776
- Defined in: [data-structures/trie/trie.ts:698](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L698)
788
+ Defined in: [data-structures/trie/trie.ts:452](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L452)
777
789
 
778
790
  Compute the height (max depth) of the trie.
779
791
 
@@ -795,7 +807,7 @@ Time O(N), Space O(H)
795
807
  getLongestCommonPrefix(): string;
796
808
  ```
797
809
 
798
- Defined in: [data-structures/trie/trie.ts:871](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L871)
810
+ Defined in: [data-structures/trie/trie.ts:543](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L543)
799
811
 
800
812
  Return the longest common prefix among all words.
801
813
 
@@ -805,8 +817,6 @@ Return the longest common prefix among all words.
805
817
 
806
818
  The longest common prefix string.
807
819
 
808
- *
809
-
810
820
  #### Remarks
811
821
 
812
822
  Time O(H), Space O(1)
@@ -831,7 +841,7 @@ getWords(
831
841
  isAllWhenEmptyPrefix?): string[];
832
842
  ```
833
843
 
834
- Defined in: [data-structures/trie/trie.ts:942](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L942)
844
+ Defined in: [data-structures/trie/trie.ts:574](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L574)
835
845
 
836
846
  Collect words under a prefix up to a maximum count.
837
847
 
@@ -861,8 +871,6 @@ When true, collect from root even if prefix is empty.
861
871
 
862
872
  Array of collected words (at most max).
863
873
 
864
- *
865
-
866
874
  #### Remarks
867
875
 
868
876
  Time O(K·L), Space O(K·L)
@@ -890,7 +898,7 @@ Time O(K·L), Space O(K·L)
890
898
  has(word): boolean;
891
899
  ```
892
900
 
893
- Defined in: [data-structures/trie/trie.ts:478](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L478)
901
+ Defined in: [data-structures/trie/trie.ts:348](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L348)
894
902
 
895
903
  Check whether a word exists.
896
904
 
@@ -908,8 +916,6 @@ Word to search for.
908
916
 
909
917
  True if present.
910
918
 
911
- *
912
-
913
919
  #### Remarks
914
920
 
915
921
  Time O(L), Space O(1)
@@ -937,7 +943,7 @@ Time O(L), Space O(1)
937
943
  hasCommonPrefix(input): boolean;
938
944
  ```
939
945
 
940
- Defined in: [data-structures/trie/trie.ts:807](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L807)
946
+ Defined in: [data-structures/trie/trie.ts:519](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L519)
941
947
 
942
948
  Check whether the trie’s longest common prefix equals input.
943
949
 
@@ -967,7 +973,7 @@ Time O(min(H,L)), Space O(1)
967
973
  hasPrefix(input): boolean;
968
974
  ```
969
975
 
970
- Defined in: [data-structures/trie/trie.ts:789](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L789)
976
+ Defined in: [data-structures/trie/trie.ts:502](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L502)
971
977
 
972
978
  Check whether any word starts with input.
973
979
 
@@ -985,8 +991,6 @@ String to test as prefix.
985
991
 
986
992
  True if input matches a path from root.
987
993
 
988
- *
989
-
990
994
  #### Remarks
991
995
 
992
996
  Time O(L), Space O(1)
@@ -1010,7 +1014,7 @@ Time O(L), Space O(1)
1010
1014
  hasPurePrefix(input): boolean;
1011
1015
  ```
1012
1016
 
1013
- Defined in: [data-structures/trie/trie.ts:725](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L725)
1017
+ Defined in: [data-structures/trie/trie.ts:478](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L478)
1014
1018
 
1015
1019
  Check whether input is a proper prefix of at least one word.
1016
1020
 
@@ -1034,13 +1038,47 @@ Time O(L), Space O(1)
1034
1038
 
1035
1039
  ***
1036
1040
 
1041
+ ### includes()
1042
+
1043
+ ```ts
1044
+ includes(element): boolean;
1045
+ ```
1046
+
1047
+ Defined in: [data-structures/base/iterable-element-base.ts:199](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L199)
1048
+
1049
+ Check whether a value exists (Array-compatible alias for `has`).
1050
+
1051
+ #### Parameters
1052
+
1053
+ ##### element
1054
+
1055
+ `string`
1056
+
1057
+ Element to search for (uses `===`).
1058
+
1059
+ #### Returns
1060
+
1061
+ `boolean`
1062
+
1063
+ `true` if found.
1064
+
1065
+ #### Remarks
1066
+
1067
+ Provided for familiarity when migrating from Array. Time O(n), Space O(1).
1068
+
1069
+ #### Inherited from
1070
+
1071
+ [`IterableElementBase`](IterableElementBase.md).[`includes`](IterableElementBase.md#includes)
1072
+
1073
+ ***
1074
+
1037
1075
  ### isEmpty()
1038
1076
 
1039
1077
  ```ts
1040
1078
  isEmpty(): boolean;
1041
1079
  ```
1042
1080
 
1043
- Defined in: [data-structures/trie/trie.ts:537](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L537)
1081
+ Defined in: [data-structures/trie/trie.ts:370](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L370)
1044
1082
 
1045
1083
  Check whether the trie is empty.
1046
1084
 
@@ -1050,8 +1088,6 @@ Check whether the trie is empty.
1050
1088
 
1051
1089
  True if size is 0.
1052
1090
 
1053
- *
1054
-
1055
1091
  #### Remarks
1056
1092
 
1057
1093
  Time O(1), Space O(1)
@@ -1072,6 +1108,30 @@ Time O(1), Space O(1)
1072
1108
 
1073
1109
  ***
1074
1110
 
1111
+ ### keys()
1112
+
1113
+ ```ts
1114
+ keys(): IterableIterator<number>;
1115
+ ```
1116
+
1117
+ Defined in: [data-structures/base/iterable-element-base.ts:218](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L218)
1118
+
1119
+ Return an iterator of numeric indices (Array-compatible).
1120
+
1121
+ #### Returns
1122
+
1123
+ `IterableIterator`\<`number`\>
1124
+
1125
+ #### Remarks
1126
+
1127
+ Provided for familiarity when migrating from Array. Time O(n), Space O(1) per step.
1128
+
1129
+ #### Inherited from
1130
+
1131
+ [`IterableElementBase`](IterableElementBase.md).[`keys`](IterableElementBase.md#keys)
1132
+
1133
+ ***
1134
+
1075
1135
  ### map()
1076
1136
 
1077
1137
  #### Call Signature
@@ -1083,12 +1143,10 @@ map<RM>(
1083
1143
  thisArg?): Trie<RM>;
1084
1144
  ```
1085
1145
 
1086
- Defined in: [data-structures/trie/trie.ts:1136](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L1136)
1146
+ Defined in: [data-structures/trie/trie.ts:653](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L653)
1087
1147
 
1088
1148
  Transform words
1089
1149
 
1090
- *
1091
-
1092
1150
  ##### Type Parameters
1093
1151
 
1094
1152
  ###### RM
@@ -1135,7 +1193,7 @@ map<EM, RM>(
1135
1193
  thisArg?): IterableElementBase<EM, RM>;
1136
1194
  ```
1137
1195
 
1138
- Defined in: [data-structures/trie/trie.ts:1149](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L1149)
1196
+ Defined in: [data-structures/trie/trie.ts:665](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L665)
1139
1197
 
1140
1198
  Map words into a new trie (possibly different record type).
1141
1199
 
@@ -1193,7 +1251,7 @@ IterableElementBase.map
1193
1251
  mapSame(callback, thisArg?): this;
1194
1252
  ```
1195
1253
 
1196
- Defined in: [data-structures/trie/trie.ts:1176](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L1176)
1254
+ Defined in: [data-structures/trie/trie.ts:690](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L690)
1197
1255
 
1198
1256
  Map words into a new trie of the same element type.
1199
1257
 
@@ -1233,7 +1291,7 @@ Time O(ΣL), Space O(ΣL)
1233
1291
  print(): void;
1234
1292
  ```
1235
1293
 
1236
- 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)
1294
+ Defined in: [data-structures/base/iterable-element-base.ts:298](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L298)
1237
1295
 
1238
1296
  Prints `toVisual()` to the console. Intended for quick debugging.
1239
1297
 
@@ -1291,7 +1349,7 @@ Time O(n), Space O(1). Throws if called on an empty structure without `initialVa
1291
1349
  reduce(callbackfn): string;
1292
1350
  ```
1293
1351
 
1294
- 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)
1352
+ Defined in: [data-structures/base/iterable-element-base.ts:225](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L225)
1295
1353
 
1296
1354
  ##### Parameters
1297
1355
 
@@ -1313,7 +1371,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:194](https://github.c
1313
1371
  reduce(callbackfn, initialValue): string;
1314
1372
  ```
1315
1373
 
1316
- 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)
1374
+ 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)
1317
1375
 
1318
1376
  ##### Parameters
1319
1377
 
@@ -1339,7 +1397,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:195](https://github.c
1339
1397
  reduce<U>(callbackfn, initialValue): U;
1340
1398
  ```
1341
1399
 
1342
- 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)
1400
+ 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)
1343
1401
 
1344
1402
  ##### Type Parameters
1345
1403
 
@@ -1413,7 +1471,7 @@ Time O(n) in the worst case; may exit early on first success. Space O(1).
1413
1471
  toArray(): string[];
1414
1472
  ```
1415
1473
 
1416
- 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)
1474
+ Defined in: [data-structures/base/iterable-element-base.ts:275](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L275)
1417
1475
 
1418
1476
  Materializes the elements into a new array.
1419
1477
 
@@ -1439,7 +1497,7 @@ Time O(n), Space O(n).
1439
1497
  toVisual(): string[];
1440
1498
  ```
1441
1499
 
1442
- 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)
1500
+ Defined in: [data-structures/base/iterable-element-base.ts:287](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L287)
1443
1501
 
1444
1502
  Returns a representation of the structure suitable for quick visualization.
1445
1503
  Defaults to an array of elements; subclasses may override to provide richer visuals.
@@ -1527,7 +1585,7 @@ Time O(1), Space O(1).
1527
1585
  get protected _total(): number;
1528
1586
  ```
1529
1587
 
1530
- Defined in: [data-structures/trie/trie.ts:278](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L278)
1588
+ Defined in: [data-structures/trie/trie.ts:265](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L265)
1531
1589
 
1532
1590
  (Protected) Get total count for base class iteration.
1533
1591
 
@@ -1549,7 +1607,7 @@ Total number of elements.
1549
1607
  protected _caseProcess(str): string;
1550
1608
  ```
1551
1609
 
1552
- Defined in: [data-structures/trie/trie.ts:1260](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L1260)
1610
+ Defined in: [data-structures/trie/trie.ts:766](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L766)
1553
1611
 
1554
1612
  (Protected) Normalize a string according to case sensitivity.
1555
1613
 
@@ -1579,7 +1637,7 @@ Time O(L), Space O(L)
1579
1637
  protected _createInstance(options?): this;
1580
1638
  ```
1581
1639
 
1582
- Defined in: [data-structures/trie/trie.ts:1193](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L1193)
1640
+ Defined in: [data-structures/trie/trie.ts:706](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L706)
1583
1641
 
1584
1642
  (Protected) Create an empty instance of the same concrete class.
1585
1643
 
@@ -1609,7 +1667,7 @@ Time O(1), Space O(1)
1609
1667
  protected _createLike<RM>(elements?, options?): Trie<RM>;
1610
1668
  ```
1611
1669
 
1612
- Defined in: [data-structures/trie/trie.ts:1214](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L1214)
1670
+ Defined in: [data-structures/trie/trie.ts:723](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L723)
1613
1671
 
1614
1672
  (Protected) Create a like-kind trie and seed it from an iterable.
1615
1673
 
@@ -1651,7 +1709,7 @@ Time O(ΣL), Space O(ΣL)
1651
1709
  protected _getIterator(): IterableIterator<string>;
1652
1710
  ```
1653
1711
 
1654
- Defined in: [data-structures/trie/trie.ts:1240](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L1240)
1712
+ Defined in: [data-structures/trie/trie.ts:747](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L747)
1655
1713
 
1656
1714
  (Protected) Iterate all words in lexicographic order of edges.
1657
1715
 
@@ -1677,7 +1735,7 @@ Time O(ΣL), Space O(H)
1677
1735
  protected _spawnLike<RM>(options?): Trie<RM>;
1678
1736
  ```
1679
1737
 
1680
- Defined in: [data-structures/trie/trie.ts:1230](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L1230)
1738
+ Defined in: [data-structures/trie/trie.ts:738](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L738)
1681
1739
 
1682
1740
  (Protected) Spawn an empty like-kind trie instance.
1683
1741
 
@@ -6,7 +6,7 @@
6
6
 
7
7
  # Class: TrieNode
8
8
 
9
- Defined in: [data-structures/trie/trie.ts:17](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L17)
9
+ Defined in: [data-structures/trie/trie.ts:16](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L16)
10
10
 
11
11
  Node used by Trie to store one character and its children.
12
12
 
@@ -22,7 +22,7 @@ Time O(1), Space O(1)
22
22
  new TrieNode(key): TrieNode;
23
23
  ```
24
24
 
25
- Defined in: [data-structures/trie/trie.ts:24](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L24)
25
+ Defined in: [data-structures/trie/trie.ts:22](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L22)
26
26
 
27
27
  Create a Trie node with a character key.
28
28
 
@@ -52,7 +52,7 @@ Time O(1), Space O(1)
52
52
  get children(): Map<string, TrieNode>;
53
53
  ```
54
54
 
55
- Defined in: [data-structures/trie/trie.ts:61](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L61)
55
+ Defined in: [data-structures/trie/trie.ts:56](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L56)
56
56
 
57
57
  Get the child map of this node.
58
58
 
@@ -72,7 +72,7 @@ Map from character to child node.
72
72
  set children(value): void;
73
73
  ```
74
74
 
75
- Defined in: [data-structures/trie/trie.ts:72](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L72)
75
+ Defined in: [data-structures/trie/trie.ts:66](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L66)
76
76
 
77
77
  Replace the child map of this node.
78
78
 
@@ -104,7 +104,7 @@ void
104
104
  get isEnd(): boolean;
105
105
  ```
106
106
 
107
- Defined in: [data-structures/trie/trie.ts:84](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L84)
107
+ Defined in: [data-structures/trie/trie.ts:77](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L77)
108
108
 
109
109
  Check whether this node marks the end of a word.
110
110
 
@@ -124,7 +124,7 @@ True if this node ends a word.
124
124
  set isEnd(value): void;
125
125
  ```
126
126
 
127
- Defined in: [data-structures/trie/trie.ts:95](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L95)
127
+ Defined in: [data-structures/trie/trie.ts:87](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L87)
128
128
 
129
129
  Mark this node as the end of a word or not.
130
130
 
@@ -156,7 +156,7 @@ void
156
156
  get key(): string;
157
157
  ```
158
158
 
159
- Defined in: [data-structures/trie/trie.ts:38](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L38)
159
+ Defined in: [data-structures/trie/trie.ts:35](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L35)
160
160
 
161
161
  Get the character key of this node.
162
162
 
@@ -176,7 +176,7 @@ Character key string.
176
176
  set key(value): void;
177
177
  ```
178
178
 
179
- Defined in: [data-structures/trie/trie.ts:49](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L49)
179
+ Defined in: [data-structures/trie/trie.ts:45](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/trie/trie.ts#L45)
180
180
 
181
181
  Set the character key of this node.
182
182