data-structure-typed 2.5.0 → 2.5.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 (246) hide show
  1. package/.vitepress/cache/deps_temp_51f5f1b0/chunk-7OIKW5WK.js +12984 -0
  2. package/.vitepress/cache/deps_temp_51f5f1b0/package.json +3 -0
  3. package/.vitepress/cache/deps_temp_51f5f1b0/vitepress___@vue_devtools-api.js +4505 -0
  4. package/.vitepress/cache/deps_temp_51f5f1b0/vitepress___@vueuse_core.js +9731 -0
  5. package/.vitepress/cache/deps_temp_51f5f1b0/vue.js +347 -0
  6. package/CHANGELOG.md +5 -1
  7. package/README.md +124 -29
  8. package/dist/cjs/binary-tree.cjs +26282 -0
  9. package/dist/cjs/graph.cjs +5422 -0
  10. package/dist/cjs/hash.cjs +1310 -0
  11. package/dist/cjs/heap.cjs +1602 -0
  12. package/dist/cjs/index.cjs +31257 -14673
  13. package/dist/cjs/linked-list.cjs +4576 -0
  14. package/dist/cjs/matrix.cjs +1080 -0
  15. package/dist/cjs/priority-queue.cjs +1376 -0
  16. package/dist/cjs/queue.cjs +4264 -0
  17. package/dist/cjs/stack.cjs +907 -0
  18. package/dist/cjs/trie.cjs +1223 -0
  19. package/dist/cjs-legacy/binary-tree.cjs +26319 -0
  20. package/dist/cjs-legacy/graph.cjs +5420 -0
  21. package/dist/cjs-legacy/hash.cjs +1310 -0
  22. package/dist/cjs-legacy/heap.cjs +1599 -0
  23. package/dist/cjs-legacy/index.cjs +31268 -14679
  24. package/dist/cjs-legacy/linked-list.cjs +4582 -0
  25. package/dist/cjs-legacy/matrix.cjs +1083 -0
  26. package/dist/cjs-legacy/priority-queue.cjs +1374 -0
  27. package/dist/cjs-legacy/queue.cjs +4262 -0
  28. package/dist/cjs-legacy/stack.cjs +907 -0
  29. package/dist/cjs-legacy/trie.cjs +1222 -0
  30. package/dist/esm/binary-tree.mjs +26267 -0
  31. package/dist/esm/graph.mjs +5409 -0
  32. package/dist/esm/hash.mjs +1307 -0
  33. package/dist/esm/heap.mjs +1596 -0
  34. package/dist/esm/index.mjs +31254 -14674
  35. package/dist/esm/linked-list.mjs +4569 -0
  36. package/dist/esm/matrix.mjs +1076 -0
  37. package/dist/esm/priority-queue.mjs +1372 -0
  38. package/dist/esm/queue.mjs +4260 -0
  39. package/dist/esm/stack.mjs +905 -0
  40. package/dist/esm/trie.mjs +1220 -0
  41. package/dist/esm-legacy/binary-tree.mjs +26304 -0
  42. package/dist/esm-legacy/graph.mjs +5407 -0
  43. package/dist/esm-legacy/hash.mjs +1307 -0
  44. package/dist/esm-legacy/heap.mjs +1593 -0
  45. package/dist/esm-legacy/index.mjs +31265 -14680
  46. package/dist/esm-legacy/linked-list.mjs +4575 -0
  47. package/dist/esm-legacy/matrix.mjs +1079 -0
  48. package/dist/esm-legacy/priority-queue.mjs +1370 -0
  49. package/dist/esm-legacy/queue.mjs +4258 -0
  50. package/dist/esm-legacy/stack.mjs +905 -0
  51. package/dist/esm-legacy/trie.mjs +1219 -0
  52. package/dist/types/common/error.d.ts +9 -0
  53. package/dist/types/common/index.d.ts +1 -1
  54. package/dist/types/data-structures/base/index.d.ts +1 -0
  55. package/dist/types/data-structures/base/iterable-entry-base.d.ts +8 -8
  56. package/dist/types/data-structures/base/linear-base.d.ts +3 -3
  57. package/dist/types/data-structures/binary-tree/avl-tree.d.ts +288 -0
  58. package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +336 -0
  59. package/dist/types/data-structures/binary-tree/binary-tree.d.ts +618 -18
  60. package/dist/types/data-structures/binary-tree/bst.d.ts +676 -1
  61. package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +456 -0
  62. package/dist/types/data-structures/binary-tree/segment-tree.d.ts +144 -1
  63. package/dist/types/data-structures/binary-tree/tree-map.d.ts +3307 -399
  64. package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +3285 -360
  65. package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +2674 -325
  66. package/dist/types/data-structures/binary-tree/tree-set.d.ts +3072 -287
  67. package/dist/types/data-structures/graph/abstract-graph.d.ts +4 -4
  68. package/dist/types/data-structures/graph/directed-graph.d.ts +240 -0
  69. package/dist/types/data-structures/graph/undirected-graph.d.ts +216 -0
  70. package/dist/types/data-structures/hash/hash-map.d.ts +274 -10
  71. package/dist/types/data-structures/heap/heap.d.ts +336 -0
  72. package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +411 -3
  73. package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +363 -3
  74. package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +434 -2
  75. package/dist/types/data-structures/matrix/matrix.d.ts +192 -0
  76. package/dist/types/data-structures/queue/deque.d.ts +364 -4
  77. package/dist/types/data-structures/queue/queue.d.ts +288 -0
  78. package/dist/types/data-structures/stack/stack.d.ts +240 -0
  79. package/dist/types/data-structures/trie/trie.d.ts +292 -4
  80. package/dist/types/interfaces/graph.d.ts +1 -1
  81. package/dist/types/types/common.d.ts +2 -2
  82. package/dist/types/types/data-structures/binary-tree/bst.d.ts +1 -0
  83. package/dist/types/types/data-structures/binary-tree/tree-map.d.ts +5 -0
  84. package/dist/types/types/data-structures/binary-tree/tree-multi-set.d.ts +4 -0
  85. package/dist/types/types/data-structures/binary-tree/tree-set.d.ts +4 -0
  86. package/dist/types/types/data-structures/heap/heap.d.ts +1 -0
  87. package/dist/types/types/data-structures/priority-queue/priority-queue.d.ts +1 -0
  88. package/dist/types/types/utils/validate-type.d.ts +4 -4
  89. package/dist/umd/data-structure-typed.js +31196 -14608
  90. package/dist/umd/data-structure-typed.min.js +11 -5
  91. package/docs-site-docusaurus/README.md +41 -0
  92. package/docs-site-docusaurus/docs/api/README.md +52 -0
  93. package/docs-site-docusaurus/docs/api/classes/AVLTree.md +6644 -0
  94. package/docs-site-docusaurus/docs/api/classes/AVLTreeNode.md +282 -0
  95. package/docs-site-docusaurus/docs/api/classes/AbstractGraph.md +2266 -0
  96. package/docs-site-docusaurus/docs/api/classes/BST.md +6293 -0
  97. package/docs-site-docusaurus/docs/api/classes/BSTNode.md +333 -0
  98. package/docs-site-docusaurus/docs/api/classes/BinaryIndexedTree.md +455 -0
  99. package/docs-site-docusaurus/docs/api/classes/BinaryTree.md +4647 -0
  100. package/docs-site-docusaurus/docs/api/classes/BinaryTreeNode.md +331 -0
  101. package/docs-site-docusaurus/docs/api/classes/Deque.md +2767 -0
  102. package/docs-site-docusaurus/docs/api/classes/DirectedGraph.md +2999 -0
  103. package/docs-site-docusaurus/docs/api/classes/DoublyLinkedList.md +2685 -0
  104. package/docs-site-docusaurus/docs/api/classes/DoublyLinkedListNode.md +221 -0
  105. package/docs-site-docusaurus/docs/api/classes/FibonacciHeap.md +253 -0
  106. package/docs-site-docusaurus/docs/api/classes/FibonacciHeapNode.md +21 -0
  107. package/docs-site-docusaurus/docs/api/classes/HashMap.md +1333 -0
  108. package/docs-site-docusaurus/docs/api/classes/Heap.md +1881 -0
  109. package/docs-site-docusaurus/docs/api/classes/IterableElementBase.md +800 -0
  110. package/docs-site-docusaurus/docs/api/classes/IterableEntryBase.md +644 -0
  111. package/docs-site-docusaurus/docs/api/classes/LinearBase.md +1632 -0
  112. package/docs-site-docusaurus/docs/api/classes/LinearLinkedBase.md +1853 -0
  113. package/docs-site-docusaurus/docs/api/classes/LinkedHashMap.md +1108 -0
  114. package/docs-site-docusaurus/docs/api/classes/LinkedListNode.md +156 -0
  115. package/docs-site-docusaurus/docs/api/classes/LinkedListQueue.md +2824 -0
  116. package/docs-site-docusaurus/docs/api/classes/MapGraph.md +2929 -0
  117. package/docs-site-docusaurus/docs/api/classes/Matrix.md +1026 -0
  118. package/docs-site-docusaurus/docs/api/classes/MaxHeap.md +1866 -0
  119. package/docs-site-docusaurus/docs/api/classes/MaxPriorityQueue.md +1883 -0
  120. package/docs-site-docusaurus/docs/api/classes/MinHeap.md +1879 -0
  121. package/docs-site-docusaurus/docs/api/classes/MinPriorityQueue.md +1882 -0
  122. package/docs-site-docusaurus/docs/api/classes/Navigator.md +109 -0
  123. package/docs-site-docusaurus/docs/api/classes/PriorityQueue.md +1839 -0
  124. package/docs-site-docusaurus/docs/api/classes/Queue.md +2244 -0
  125. package/docs-site-docusaurus/docs/api/classes/RedBlackTree.md +6888 -0
  126. package/docs-site-docusaurus/docs/api/classes/SegmentTree.md +372 -0
  127. package/docs-site-docusaurus/docs/api/classes/SinglyLinkedList.md +2897 -0
  128. package/docs-site-docusaurus/docs/api/classes/SinglyLinkedListNode.md +169 -0
  129. package/docs-site-docusaurus/docs/api/classes/SkipList.md +1229 -0
  130. package/docs-site-docusaurus/docs/api/classes/Stack.md +1573 -0
  131. package/docs-site-docusaurus/docs/api/classes/TreeMap.md +1389 -0
  132. package/docs-site-docusaurus/docs/api/classes/TreeMultiMap.md +1591 -0
  133. package/docs-site-docusaurus/docs/api/classes/TreeSet.md +1246 -0
  134. package/docs-site-docusaurus/docs/api/classes/Trie.md +1708 -0
  135. package/docs-site-docusaurus/docs/api/classes/TrieNode.md +199 -0
  136. package/docs-site-docusaurus/docs/api/classes/UndirectedGraph.md +2979 -0
  137. package/docs-site-docusaurus/docs/guide/_category_.json +6 -0
  138. package/docs-site-docusaurus/docs/guide/architecture.md +615 -0
  139. package/docs-site-docusaurus/docs/guide/concepts.md +451 -0
  140. package/docs-site-docusaurus/docs/guide/faq.md +180 -0
  141. package/docs-site-docusaurus/docs/guide/guides.md +597 -0
  142. package/docs-site-docusaurus/docs/guide/installation.md +62 -0
  143. package/docs-site-docusaurus/docs/guide/integrations.md +825 -0
  144. package/docs-site-docusaurus/docs/guide/overview.md +645 -0
  145. package/docs-site-docusaurus/docs/guide/performance.md +835 -0
  146. package/docs-site-docusaurus/docs/guide/quick-start.md +104 -0
  147. package/docs-site-docusaurus/docs/guide/use-cases/_category_.json +6 -0
  148. package/docs-site-docusaurus/docs/guide/use-cases/array-sort-alternative.md +158 -0
  149. package/docs-site-docusaurus/docs/guide/use-cases/heap-vs-sorting.md +92 -0
  150. package/docs-site-docusaurus/docs/guide/use-cases/map-vs-treemap.md +151 -0
  151. package/docs-site-docusaurus/docs/guide/use-cases/priority-queue-typescript.md +113 -0
  152. package/docs-site-docusaurus/docs/guide/use-cases/treemap-javascript.md +151 -0
  153. package/docs-site-docusaurus/docusaurus.config.ts +159 -0
  154. package/docs-site-docusaurus/fix-mdx-generics.mjs +75 -0
  155. package/docs-site-docusaurus/package-lock.json +18667 -0
  156. package/docs-site-docusaurus/package.json +50 -0
  157. package/docs-site-docusaurus/prefix-class-to-methods.mjs +48 -0
  158. package/docs-site-docusaurus/sidebars.ts +23 -0
  159. package/docs-site-docusaurus/sort-protected.mjs +87 -0
  160. package/docs-site-docusaurus/src/css/custom.css +96 -0
  161. package/docs-site-docusaurus/src/pages/index.module.css +13 -0
  162. package/docs-site-docusaurus/src/pages/index.tsx +120 -0
  163. package/docs-site-docusaurus/src/pages/markdown-page.md +7 -0
  164. package/docs-site-docusaurus/src/theme/TOCItems/index.tsx +34 -0
  165. package/docs-site-docusaurus/static/.nojekyll +0 -0
  166. package/docs-site-docusaurus/static/img/docusaurus-social-card.jpg +0 -0
  167. package/docs-site-docusaurus/static/img/docusaurus.png +0 -0
  168. package/docs-site-docusaurus/static/img/favicon.ico +0 -0
  169. package/docs-site-docusaurus/static/img/favicon.png +0 -0
  170. package/docs-site-docusaurus/static/img/logo-180.png +0 -0
  171. package/docs-site-docusaurus/static/img/logo.jpg +0 -0
  172. package/docs-site-docusaurus/static/img/logo.png +0 -0
  173. package/docs-site-docusaurus/static/img/logo.svg +1 -0
  174. package/docs-site-docusaurus/static/img/og-image.png +0 -0
  175. package/docs-site-docusaurus/static/img/undraw_docusaurus_mountain.svg +171 -0
  176. package/docs-site-docusaurus/static/img/undraw_docusaurus_react.svg +170 -0
  177. package/docs-site-docusaurus/static/img/undraw_docusaurus_tree.svg +40 -0
  178. package/docs-site-docusaurus/static/llms.txt +37 -0
  179. package/docs-site-docusaurus/static/robots.txt +4 -0
  180. package/docs-site-docusaurus/typedoc.json +23 -0
  181. package/llms.txt +37 -0
  182. package/package.json +159 -55
  183. package/src/common/error.ts +19 -1
  184. package/src/common/index.ts +1 -1
  185. package/src/data-structures/base/index.ts +1 -0
  186. package/src/data-structures/base/iterable-element-base.ts +3 -2
  187. package/src/data-structures/base/iterable-entry-base.ts +8 -8
  188. package/src/data-structures/base/linear-base.ts +3 -3
  189. package/src/data-structures/binary-tree/avl-tree.ts +287 -0
  190. package/src/data-structures/binary-tree/binary-indexed-tree.ts +327 -5
  191. package/src/data-structures/binary-tree/binary-tree.ts +581 -6
  192. package/src/data-structures/binary-tree/bst.ts +922 -7
  193. package/src/data-structures/binary-tree/red-black-tree.ts +453 -0
  194. package/src/data-structures/binary-tree/segment-tree.ts +139 -2
  195. package/src/data-structures/binary-tree/tree-map.ts +3300 -495
  196. package/src/data-structures/binary-tree/tree-multi-map.ts +3384 -563
  197. package/src/data-structures/binary-tree/tree-multi-set.ts +2757 -493
  198. package/src/data-structures/binary-tree/tree-set.ts +3122 -440
  199. package/src/data-structures/graph/abstract-graph.ts +6 -6
  200. package/src/data-structures/graph/directed-graph.ts +230 -0
  201. package/src/data-structures/graph/undirected-graph.ts +207 -0
  202. package/src/data-structures/hash/hash-map.ts +270 -19
  203. package/src/data-structures/heap/heap.ts +326 -4
  204. package/src/data-structures/heap/max-heap.ts +2 -2
  205. package/src/data-structures/linked-list/doubly-linked-list.ts +394 -3
  206. package/src/data-structures/linked-list/singly-linked-list.ts +348 -3
  207. package/src/data-structures/linked-list/skip-linked-list.ts +421 -7
  208. package/src/data-structures/matrix/matrix.ts +194 -10
  209. package/src/data-structures/priority-queue/max-priority-queue.ts +2 -2
  210. package/src/data-structures/queue/deque.ts +350 -5
  211. package/src/data-structures/queue/queue.ts +276 -0
  212. package/src/data-structures/stack/stack.ts +230 -0
  213. package/src/data-structures/trie/trie.ts +283 -7
  214. package/src/interfaces/graph.ts +1 -1
  215. package/src/types/common.ts +2 -2
  216. package/src/types/data-structures/binary-tree/bst.ts +1 -0
  217. package/src/types/data-structures/binary-tree/tree-map.ts +6 -0
  218. package/src/types/data-structures/binary-tree/tree-multi-set.ts +5 -0
  219. package/src/types/data-structures/binary-tree/tree-set.ts +5 -0
  220. package/src/types/data-structures/heap/heap.ts +1 -0
  221. package/src/types/data-structures/priority-queue/priority-queue.ts +1 -0
  222. package/src/types/utils/validate-type.ts +4 -4
  223. package/vercel.json +6 -0
  224. package/dist/leetcode/avl-tree-counter.mjs +0 -2957
  225. package/dist/leetcode/avl-tree-multi-map.mjs +0 -2889
  226. package/dist/leetcode/avl-tree.mjs +0 -2720
  227. package/dist/leetcode/binary-tree.mjs +0 -1594
  228. package/dist/leetcode/bst.mjs +0 -2398
  229. package/dist/leetcode/deque.mjs +0 -683
  230. package/dist/leetcode/directed-graph.mjs +0 -1733
  231. package/dist/leetcode/doubly-linked-list.mjs +0 -709
  232. package/dist/leetcode/hash-map.mjs +0 -493
  233. package/dist/leetcode/heap.mjs +0 -542
  234. package/dist/leetcode/max-heap.mjs +0 -375
  235. package/dist/leetcode/max-priority-queue.mjs +0 -383
  236. package/dist/leetcode/min-heap.mjs +0 -363
  237. package/dist/leetcode/min-priority-queue.mjs +0 -371
  238. package/dist/leetcode/priority-queue.mjs +0 -363
  239. package/dist/leetcode/queue.mjs +0 -943
  240. package/dist/leetcode/red-black-tree.mjs +0 -2765
  241. package/dist/leetcode/singly-linked-list.mjs +0 -754
  242. package/dist/leetcode/stack.mjs +0 -217
  243. package/dist/leetcode/tree-counter.mjs +0 -3039
  244. package/dist/leetcode/tree-multi-map.mjs +0 -2913
  245. package/dist/leetcode/trie.mjs +0 -413
  246. package/dist/leetcode/undirected-graph.mjs +0 -1650
@@ -0,0 +1,1632 @@
1
+ [**data-structure-typed**](../README.md)
2
+
3
+ ***
4
+
5
+ [data-structure-typed](../README.md) / LinearBase
6
+
7
+ # Abstract Class: LinearBase\<E, R, NODE\>
8
+
9
+ Defined in: [data-structures/base/linear-base.ts:68](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L68)
10
+
11
+ Abstract linear container with array-like utilities.
12
+
13
+ ## Remarks
14
+
15
+ Time O(1), Space O(1)
16
+
17
+ ## Extends
18
+
19
+ - [`IterableElementBase`](IterableElementBase.md)\<`E`, `R`\>
20
+
21
+ ## Extended by
22
+
23
+ - [`Queue`](Queue.md)
24
+ - [`Deque`](Deque.md)
25
+ - [`LinearLinkedBase`](LinearLinkedBase.md)
26
+
27
+ ## Type Parameters
28
+
29
+ ### E
30
+
31
+ `E`
32
+
33
+ Element type.
34
+
35
+ ### R
36
+
37
+ `R` = `any`
38
+
39
+ Return type for mapped/derived views.
40
+
41
+ ### NODE
42
+
43
+ `NODE` *extends* [`LinkedListNode`](LinkedListNode.md)\<`E`\> = [`LinkedListNode`](LinkedListNode.md)\<`E`\>
44
+
45
+ Linked node type used by some implementations.
46
+
47
+ ## Constructors
48
+
49
+ ### Constructor
50
+
51
+ ```ts
52
+ new LinearBase<E, R, NODE>(options?): LinearBase<E, R, NODE>;
53
+ ```
54
+
55
+ Defined in: [data-structures/base/linear-base.ts:78](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L78)
56
+
57
+ Construct a linear container with runtime options.
58
+
59
+ #### Parameters
60
+
61
+ ##### options?
62
+
63
+ `LinearBaseOptions`\<`E`, `R`\>
64
+
65
+ `{ maxLen?, ... }` bounds/behavior options.
66
+
67
+ #### Returns
68
+
69
+ `LinearBase`\<`E`, `R`, `NODE`\>
70
+
71
+ #### Remarks
72
+
73
+ Time O(1), Space O(1)
74
+
75
+ #### Overrides
76
+
77
+ [`IterableElementBase`](IterableElementBase.md).[`constructor`](IterableElementBase.md#constructor)
78
+
79
+ ## Properties
80
+
81
+ ### length
82
+
83
+ #### Get Signature
84
+
85
+ ```ts
86
+ get abstract length(): number;
87
+ ```
88
+
89
+ Defined in: [data-structures/base/linear-base.ts:91](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L91)
90
+
91
+ Element count.
92
+
93
+ ##### Remarks
94
+
95
+ Time O(1), Space O(1)
96
+
97
+ ##### Returns
98
+
99
+ `number`
100
+
101
+ Number of elements.
102
+
103
+ ***
104
+
105
+ ### maxLen
106
+
107
+ #### Get Signature
108
+
109
+ ```ts
110
+ get maxLen(): number;
111
+ ```
112
+
113
+ Defined in: [data-structures/base/linear-base.ts:100](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L100)
114
+
115
+ Upper bound for length (if positive), or `-1` when unbounded.
116
+
117
+ ##### Remarks
118
+
119
+ Time O(1), Space O(1)
120
+
121
+ ##### Returns
122
+
123
+ `number`
124
+
125
+ Maximum allowed length.
126
+
127
+ ***
128
+
129
+ ### toElementFn
130
+
131
+ #### Get Signature
132
+
133
+ ```ts
134
+ get toElementFn(): ((rawElement) => E) | undefined;
135
+ ```
136
+
137
+ Defined in: [data-structures/base/iterable-element-base.ts:48](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L48)
138
+
139
+ Exposes the current `toElementFn`, if configured.
140
+
141
+ ##### Remarks
142
+
143
+ Time O(1), Space O(1).
144
+
145
+ ##### Returns
146
+
147
+ ((`rawElement`) => `E`) \| `undefined`
148
+
149
+ The converter function or `undefined` when not set.
150
+
151
+ #### Inherited from
152
+
153
+ [`IterableElementBase`](IterableElementBase.md).[`toElementFn`](IterableElementBase.md#toelementfn)
154
+
155
+ ## Methods
156
+
157
+ ### \[iterator\]()
158
+
159
+ ```ts
160
+ iterator: IterableIterator<E>;
161
+ ```
162
+
163
+ Defined in: [data-structures/base/iterable-element-base.ts:61](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L61)
164
+
165
+ Returns an iterator over the structure's elements.
166
+
167
+ #### Parameters
168
+
169
+ ##### args
170
+
171
+ ...`unknown`[]
172
+
173
+ Optional iterator arguments forwarded to the internal iterator.
174
+
175
+ #### Returns
176
+
177
+ `IterableIterator`\<`E`\>
178
+
179
+ An `IterableIterator<E>` that yields the elements in traversal order.
180
+
181
+ #### Remarks
182
+
183
+ Producing the iterator is O(1); consuming the entire iterator is Time O(n) with O(1) extra space.
184
+
185
+ #### Inherited from
186
+
187
+ [`IterableElementBase`](IterableElementBase.md).[`[iterator]`](IterableElementBase.md#iterator)
188
+
189
+ ***
190
+
191
+ ### addAt()
192
+
193
+ ```ts
194
+ abstract addAt(index, newElementOrNode): boolean;
195
+ ```
196
+
197
+ Defined in: [data-structures/base/linear-base.ts:377](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L377)
198
+
199
+ Insert an element/node at a position.
200
+
201
+ #### Parameters
202
+
203
+ ##### index
204
+
205
+ `number`
206
+
207
+ Position (0-based).
208
+
209
+ ##### newElementOrNode
210
+
211
+ `E` \| `NODE`
212
+
213
+ Element or node to insert.
214
+
215
+ #### Returns
216
+
217
+ `boolean`
218
+
219
+ `true` if inserted.
220
+
221
+ #### Remarks
222
+
223
+ Time O(1)~O(n) depending on implementation, Space O(1)
224
+
225
+ ***
226
+
227
+ ### at()
228
+
229
+ ```ts
230
+ abstract at(index): E | undefined;
231
+ ```
232
+
233
+ Defined in: [data-structures/base/linear-base.ts:360](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L360)
234
+
235
+ Get element at an index.
236
+
237
+ #### Parameters
238
+
239
+ ##### index
240
+
241
+ `number`
242
+
243
+ Position (0-based).
244
+
245
+ #### Returns
246
+
247
+ `E` \| `undefined`
248
+
249
+ Element or `undefined`.
250
+
251
+ #### Remarks
252
+
253
+ Time O(1)~O(n) depending on implementation, Space O(1)
254
+
255
+ ***
256
+
257
+ ### clear()
258
+
259
+ ```ts
260
+ abstract clear(): void;
261
+ ```
262
+
263
+ Defined in: [data-structures/base/iterable-element-base.ts:289](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L289)
264
+
265
+ Removes all elements from the structure.
266
+
267
+ #### Returns
268
+
269
+ `void`
270
+
271
+ `void`.
272
+
273
+ #### Remarks
274
+
275
+ Expected Time O(1) or O(n) depending on the implementation; Space O(1).
276
+
277
+ #### Inherited from
278
+
279
+ [`IterableElementBase`](IterableElementBase.md).[`clear`](IterableElementBase.md#clear)
280
+
281
+ ***
282
+
283
+ ### clone()
284
+
285
+ ```ts
286
+ abstract clone(): this;
287
+ ```
288
+
289
+ Defined in: [data-structures/base/linear-base.ts:321](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L321)
290
+
291
+ Deep clone while preserving concrete subtype.
292
+
293
+ #### Returns
294
+
295
+ `this`
296
+
297
+ New list of the same species (`this` type).
298
+
299
+ #### Remarks
300
+
301
+ Time O(n), Space O(n)
302
+
303
+ #### Overrides
304
+
305
+ [`IterableElementBase`](IterableElementBase.md).[`clone`](IterableElementBase.md#clone)
306
+
307
+ ***
308
+
309
+ ### concat()
310
+
311
+ ```ts
312
+ concat(...items): this;
313
+ ```
314
+
315
+ Defined in: [data-structures/base/linear-base.ts:165](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L165)
316
+
317
+ Concatenate elements and/or containers.
318
+
319
+ #### Parameters
320
+
321
+ ##### items
322
+
323
+ ...(`E` \| `LinearBase`\<`E`, `R`, `NODE`\>)[]
324
+
325
+ Elements or other containers.
326
+
327
+ #### Returns
328
+
329
+ `this`
330
+
331
+ New container with combined elements (`this` type).
332
+
333
+ #### Remarks
334
+
335
+ Time O(sum(length)), Space O(sum(length))
336
+
337
+ ***
338
+
339
+ ### delete()
340
+
341
+ ```ts
342
+ abstract delete(elementOrNode): boolean;
343
+ ```
344
+
345
+ Defined in: [data-structures/base/linear-base.ts:352](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L352)
346
+
347
+ Remove one element or node if present.
348
+
349
+ #### Parameters
350
+
351
+ ##### elementOrNode
352
+
353
+ `E` \| `NODE` \| `undefined`
354
+
355
+ Element or node to delete.
356
+
357
+ #### Returns
358
+
359
+ `boolean`
360
+
361
+ `true` if removed.
362
+
363
+ #### Remarks
364
+
365
+ Time O(1)~O(n) depending on implementation, Space O(1)
366
+
367
+ ***
368
+
369
+ ### deleteAt()
370
+
371
+ ```ts
372
+ abstract deleteAt(pos): E | undefined;
373
+ ```
374
+
375
+ Defined in: [data-structures/base/linear-base.ts:368](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L368)
376
+
377
+ Remove element at a position.
378
+
379
+ #### Parameters
380
+
381
+ ##### pos
382
+
383
+ `number`
384
+
385
+ Position (0-based).
386
+
387
+ #### Returns
388
+
389
+ `E` \| `undefined`
390
+
391
+ Removed element or `undefined`.
392
+
393
+ #### Remarks
394
+
395
+ Time O(1)~O(n) depending on implementation, Space O(1)
396
+
397
+ ***
398
+
399
+ ### every()
400
+
401
+ ```ts
402
+ every(predicate, thisArg?): boolean;
403
+ ```
404
+
405
+ Defined in: [data-structures/base/iterable-element-base.ts:87](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L87)
406
+
407
+ Tests whether all elements satisfy the predicate.
408
+
409
+ #### Parameters
410
+
411
+ ##### predicate
412
+
413
+ `ElementCallback`\<`E`, `R`, `boolean`\>
414
+
415
+ Function invoked for each element with signature `(value, index, self)`.
416
+
417
+ ##### thisArg?
418
+
419
+ `unknown`
420
+
421
+ Optional `this` binding for the predicate.
422
+
423
+ #### Returns
424
+
425
+ `boolean`
426
+
427
+ `true` if every element passes; otherwise `false`.
428
+
429
+ #### Remarks
430
+
431
+ Time O(n) in the worst case; may exit early when the first failure is found. Space O(1).
432
+
433
+ #### Inherited from
434
+
435
+ [`IterableElementBase`](IterableElementBase.md).[`every`](IterableElementBase.md#every)
436
+
437
+ ***
438
+
439
+ ### fill()
440
+
441
+ ```ts
442
+ fill(
443
+ value,
444
+ start?,
445
+ end?): this;
446
+ ```
447
+
448
+ Defined in: [data-structures/base/linear-base.ts:292](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L292)
449
+
450
+ Fill a range with a value.
451
+
452
+ #### Parameters
453
+
454
+ ##### value
455
+
456
+ `E`
457
+
458
+ Value to set.
459
+
460
+ ##### start?
461
+
462
+ `number` = `0`
463
+
464
+ Inclusive start.
465
+
466
+ ##### end?
467
+
468
+ `number` = `...`
469
+
470
+ Exclusive end.
471
+
472
+ #### Returns
473
+
474
+ `this`
475
+
476
+ This list.
477
+
478
+ #### Remarks
479
+
480
+ Time O(n), Space O(1)
481
+
482
+ ***
483
+
484
+ ### filter()
485
+
486
+ ```ts
487
+ abstract filter(predicate, thisArg?): this;
488
+ ```
489
+
490
+ Defined in: [data-structures/base/iterable-element-base.ts:341](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L341)
491
+
492
+ Filters elements using the provided predicate and returns the same concrete structure type.
493
+
494
+ #### Parameters
495
+
496
+ ##### predicate
497
+
498
+ `ElementCallback`\<`E`, `R`, `boolean`\>
499
+
500
+ Function with signature `(value, index, self) => boolean`.
501
+
502
+ ##### thisArg?
503
+
504
+ `unknown`
505
+
506
+ Optional `this` binding for the predicate.
507
+
508
+ #### Returns
509
+
510
+ `this`
511
+
512
+ A new instance of the same concrete type containing only elements that pass the predicate.
513
+
514
+ #### Remarks
515
+
516
+ Time O(n), Space O(k) where `k` is the number of kept elements.
517
+
518
+ #### Inherited from
519
+
520
+ [`IterableElementBase`](IterableElementBase.md).[`filter`](IterableElementBase.md#filter)
521
+
522
+ ***
523
+
524
+ ### find()
525
+
526
+ #### Call Signature
527
+
528
+ ```ts
529
+ find<S>(predicate, thisArg?): S | undefined;
530
+ ```
531
+
532
+ Defined in: [data-structures/base/iterable-element-base.ts:163](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L163)
533
+
534
+ Finds the first element that satisfies the predicate and returns it.
535
+
536
+ Finds the first element of type `S` (a subtype of `E`) that satisfies the predicate and returns it.
537
+
538
+ ##### Type Parameters
539
+
540
+ ###### S
541
+
542
+ `S`
543
+
544
+ ##### Parameters
545
+
546
+ ###### predicate
547
+
548
+ `ElementCallback`\<`E`, `R`, `S`\>
549
+
550
+ Type-guard predicate: `(value, index, self) => value is S`.
551
+
552
+ ###### thisArg?
553
+
554
+ `unknown`
555
+
556
+ Optional `this` binding for the predicate.
557
+
558
+ ##### Returns
559
+
560
+ `S` \| `undefined`
561
+
562
+ The matched element typed as `S`, or `undefined` if not found.
563
+
564
+ ##### Remarks
565
+
566
+ Time O(n) in the worst case; may exit early on the first match. Space O(1).
567
+
568
+ ##### Inherited from
569
+
570
+ [`IterableElementBase`](IterableElementBase.md).[`find`](IterableElementBase.md#find)
571
+
572
+ #### Call Signature
573
+
574
+ ```ts
575
+ find(predicate, thisArg?): E | undefined;
576
+ ```
577
+
578
+ Defined in: [data-structures/base/iterable-element-base.ts:164](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L164)
579
+
580
+ Finds the first element that satisfies the predicate and returns it.
581
+
582
+ Finds the first element of type `S` (a subtype of `E`) that satisfies the predicate and returns it.
583
+
584
+ ##### Parameters
585
+
586
+ ###### predicate
587
+
588
+ `ElementCallback`\<`E`, `R`, `unknown`\>
589
+
590
+ Type-guard predicate: `(value, index, self) => value is S`.
591
+
592
+ ###### thisArg?
593
+
594
+ `unknown`
595
+
596
+ Optional `this` binding for the predicate.
597
+
598
+ ##### Returns
599
+
600
+ `E` \| `undefined`
601
+
602
+ The matched element typed as `S`, or `undefined` if not found.
603
+
604
+ ##### Remarks
605
+
606
+ Time O(n) in the worst case; may exit early on the first match. Space O(1).
607
+
608
+ ##### Inherited from
609
+
610
+ [`IterableElementBase`](IterableElementBase.md).[`find`](IterableElementBase.md#find)
611
+
612
+ ***
613
+
614
+ ### findIndex()
615
+
616
+ ```ts
617
+ findIndex(predicate, thisArg?): number;
618
+ ```
619
+
620
+ Defined in: [data-structures/base/linear-base.ts:151](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L151)
621
+
622
+ Find the first index matching a predicate.
623
+
624
+ #### Parameters
625
+
626
+ ##### predicate
627
+
628
+ `ElementCallback`\<`E`, `R`, `boolean`\>
629
+
630
+ `(element, index, self) => boolean`.
631
+
632
+ ##### thisArg?
633
+
634
+ `unknown`
635
+
636
+ Optional `this` for callback.
637
+
638
+ #### Returns
639
+
640
+ `number`
641
+
642
+ Index or `-1`.
643
+
644
+ #### Remarks
645
+
646
+ Time O(n), Space O(1)
647
+
648
+ ***
649
+
650
+ ### forEach()
651
+
652
+ ```ts
653
+ forEach(callbackfn, thisArg?): void;
654
+ ```
655
+
656
+ Defined in: [data-structures/base/iterable-element-base.ts:133](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L133)
657
+
658
+ Invokes a callback for each element in iteration order.
659
+
660
+ #### Parameters
661
+
662
+ ##### callbackfn
663
+
664
+ `ElementCallback`\<`E`, `R`, `void`\>
665
+
666
+ Function invoked per element with signature `(value, index, self)`.
667
+
668
+ ##### thisArg?
669
+
670
+ `unknown`
671
+
672
+ Optional `this` binding for the callback.
673
+
674
+ #### Returns
675
+
676
+ `void`
677
+
678
+ `void`.
679
+
680
+ #### Remarks
681
+
682
+ Time O(n), Space O(1).
683
+
684
+ #### Inherited from
685
+
686
+ [`IterableElementBase`](IterableElementBase.md).[`forEach`](IterableElementBase.md#foreach)
687
+
688
+ ***
689
+
690
+ ### has()
691
+
692
+ ```ts
693
+ has(element): boolean;
694
+ ```
695
+
696
+ Defined in: [data-structures/base/iterable-element-base.ts:189](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L189)
697
+
698
+ Checks whether a strictly-equal element exists in the structure.
699
+
700
+ #### Parameters
701
+
702
+ ##### element
703
+
704
+ `E`
705
+
706
+ The element to test with `===` equality.
707
+
708
+ #### Returns
709
+
710
+ `boolean`
711
+
712
+ `true` if an equal element is found; otherwise `false`.
713
+
714
+ #### Remarks
715
+
716
+ Time O(n) in the worst case. Space O(1).
717
+
718
+ #### Inherited from
719
+
720
+ [`IterableElementBase`](IterableElementBase.md).[`has`](IterableElementBase.md#has)
721
+
722
+ ***
723
+
724
+ ### indexOf()
725
+
726
+ ```ts
727
+ indexOf(searchElement, fromIndex?): number;
728
+ ```
729
+
730
+ Defined in: [data-structures/base/linear-base.ts:111](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L111)
731
+
732
+ First index of a value from the left.
733
+
734
+ #### Parameters
735
+
736
+ ##### searchElement
737
+
738
+ `E`
739
+
740
+ Value to match.
741
+
742
+ ##### fromIndex?
743
+
744
+ `number` = `0`
745
+
746
+ Start position (supports negative index).
747
+
748
+ #### Returns
749
+
750
+ `number`
751
+
752
+ Index or `-1` if not found.
753
+
754
+ #### Remarks
755
+
756
+ Time O(n), Space O(1)
757
+
758
+ ***
759
+
760
+ ### isEmpty()
761
+
762
+ ```ts
763
+ abstract isEmpty(): boolean;
764
+ ```
765
+
766
+ Defined in: [data-structures/base/iterable-element-base.ts:280](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L280)
767
+
768
+ Indicates whether the structure currently contains no elements.
769
+
770
+ #### Returns
771
+
772
+ `boolean`
773
+
774
+ `true` if empty; otherwise `false`.
775
+
776
+ #### Remarks
777
+
778
+ Expected Time O(1), Space O(1) for most implementations.
779
+
780
+ #### Inherited from
781
+
782
+ [`IterableElementBase`](IterableElementBase.md).[`isEmpty`](IterableElementBase.md#isempty)
783
+
784
+ ***
785
+
786
+ ### join()
787
+
788
+ ```ts
789
+ join(separator?): string;
790
+ ```
791
+
792
+ Defined in: [data-structures/base/linear-base.ts:228](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L228)
793
+
794
+ Join all elements into a string.
795
+
796
+ #### Parameters
797
+
798
+ ##### separator?
799
+
800
+ `string` = `','`
801
+
802
+ Separator string.
803
+
804
+ #### Returns
805
+
806
+ `string`
807
+
808
+ Concatenated string.
809
+
810
+ #### Remarks
811
+
812
+ Time O(n), Space O(n)
813
+
814
+ ***
815
+
816
+ ### lastIndexOf()
817
+
818
+ ```ts
819
+ lastIndexOf(searchElement, fromIndex?): number;
820
+ ```
821
+
822
+ Defined in: [data-structures/base/linear-base.ts:131](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L131)
823
+
824
+ Last index of a value from the right.
825
+
826
+ #### Parameters
827
+
828
+ ##### searchElement
829
+
830
+ `E`
831
+
832
+ Value to match.
833
+
834
+ ##### fromIndex?
835
+
836
+ `number` = `...`
837
+
838
+ Start position (supports negative index).
839
+
840
+ #### Returns
841
+
842
+ `number`
843
+
844
+ Index or `-1` if not found.
845
+
846
+ #### Remarks
847
+
848
+ Time O(n), Space O(1)
849
+
850
+ ***
851
+
852
+ ### map()
853
+
854
+ ```ts
855
+ abstract map<EM, RM>(
856
+ callback,
857
+ options?,
858
+ thisArg?): IterableElementBase<EM, RM>;
859
+ ```
860
+
861
+ Defined in: [data-structures/base/iterable-element-base.ts:313](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L313)
862
+
863
+ Maps each element to a new element and returns a new iterable structure.
864
+
865
+ #### Type Parameters
866
+
867
+ ##### EM
868
+
869
+ `EM`
870
+
871
+ The mapped element type.
872
+
873
+ ##### RM
874
+
875
+ `RM`
876
+
877
+ The mapped raw element type used internally by the target structure.
878
+
879
+ #### Parameters
880
+
881
+ ##### callback
882
+
883
+ `ElementCallback`\<`E`, `R`, `EM`\>
884
+
885
+ Function with signature `(value, index, self) => mapped`.
886
+
887
+ ##### options?
888
+
889
+ `IterableElementBaseOptions`\<`EM`, `RM`\>
890
+
891
+ Optional options for the returned structure, including its `toElementFn`.
892
+
893
+ ##### thisArg?
894
+
895
+ `unknown`
896
+
897
+ Optional `this` binding for the callback.
898
+
899
+ #### Returns
900
+
901
+ [`IterableElementBase`](IterableElementBase.md)\<`EM`, `RM`\>
902
+
903
+ A new `IterableElementBase<EM, RM>` containing mapped elements.
904
+
905
+ #### Remarks
906
+
907
+ Time O(n), Space O(n).
908
+
909
+ #### Inherited from
910
+
911
+ [`IterableElementBase`](IterableElementBase.md).[`map`](IterableElementBase.md#map)
912
+
913
+ ***
914
+
915
+ ### mapSame()
916
+
917
+ ```ts
918
+ abstract mapSame(callback, thisArg?): this;
919
+ ```
920
+
921
+ Defined in: [data-structures/base/iterable-element-base.ts:329](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L329)
922
+
923
+ Maps each element to the same element type and returns the same concrete structure type.
924
+
925
+ #### Parameters
926
+
927
+ ##### callback
928
+
929
+ `ElementCallback`\<`E`, `R`, `E`\>
930
+
931
+ Function with signature `(value, index, self) => mappedValue`.
932
+
933
+ ##### thisArg?
934
+
935
+ `unknown`
936
+
937
+ Optional `this` binding for the callback.
938
+
939
+ #### Returns
940
+
941
+ `this`
942
+
943
+ A new instance of the same concrete type with mapped elements.
944
+
945
+ #### Remarks
946
+
947
+ Time O(n), Space O(n).
948
+
949
+ #### Inherited from
950
+
951
+ [`IterableElementBase`](IterableElementBase.md).[`mapSame`](IterableElementBase.md#mapsame)
952
+
953
+ ***
954
+
955
+ ### print()
956
+
957
+ ```ts
958
+ print(): void;
959
+ ```
960
+
961
+ Defined in: [data-structures/base/iterable-element-base.ts:269](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L269)
962
+
963
+ Prints `toVisual()` to the console. Intended for quick debugging.
964
+
965
+ #### Returns
966
+
967
+ `void`
968
+
969
+ `void`.
970
+
971
+ #### Remarks
972
+
973
+ Time O(n) due to materialization, Space O(n) for the intermediate representation.
974
+
975
+ #### Inherited from
976
+
977
+ [`IterableElementBase`](IterableElementBase.md).[`print`](IterableElementBase.md#print)
978
+
979
+ ***
980
+
981
+ ### push()
982
+
983
+ ```ts
984
+ abstract push(elementOrNode): boolean;
985
+ ```
986
+
987
+ Defined in: [data-structures/base/linear-base.ts:336](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L336)
988
+
989
+ Append one element or node to the tail.
990
+
991
+ #### Parameters
992
+
993
+ ##### elementOrNode
994
+
995
+ `E` \| `NODE`
996
+
997
+ Element or node.
998
+
999
+ #### Returns
1000
+
1001
+ `boolean`
1002
+
1003
+ `true` if appended.
1004
+
1005
+ #### Remarks
1006
+
1007
+ Time O(1) amortized typical, Space O(1)
1008
+
1009
+ ***
1010
+
1011
+ ### pushMany()
1012
+
1013
+ ```ts
1014
+ abstract pushMany(elements): boolean[];
1015
+ ```
1016
+
1017
+ Defined in: [data-structures/base/linear-base.ts:344](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L344)
1018
+
1019
+ Append many elements/nodes at once.
1020
+
1021
+ #### Parameters
1022
+
1023
+ ##### elements
1024
+
1025
+ \| `Iterable`\<`E`, `any`, `any`\>
1026
+ \| `Iterable`\<`R`, `any`, `any`\>
1027
+ \| `Iterable`\<`NODE`, `any`, `any`\>
1028
+
1029
+ Iterable of elements or nodes.
1030
+
1031
+ #### Returns
1032
+
1033
+ `boolean`[]
1034
+
1035
+ Array of booleans indicating append success.
1036
+
1037
+ #### Remarks
1038
+
1039
+ Time O(n), Space O(1)
1040
+
1041
+ ***
1042
+
1043
+ ### reduce()
1044
+
1045
+ Reduces all elements to a single accumulated value.
1046
+
1047
+ #### Param
1048
+
1049
+ Reducer of signature `(acc, value, index, self) => nextAcc`. The first element is used as the initial accumulator.
1050
+
1051
+ #### Param
1052
+
1053
+ Reducer of signature `(acc, value, index, self) => nextAcc`.
1054
+
1055
+ #### Param
1056
+
1057
+ The initial accumulator value of type `E`.
1058
+
1059
+ #### Template
1060
+
1061
+ The accumulator type when it differs from `E`.
1062
+
1063
+ #### Param
1064
+
1065
+ Reducer of signature `(acc: U, value, index, self) => U`.
1066
+
1067
+ #### Param
1068
+
1069
+ The initial accumulator value of type `U`.
1070
+
1071
+ #### Remarks
1072
+
1073
+ Time O(n), Space O(1). Throws if called on an empty structure without `initialValue`.
1074
+
1075
+ #### Call Signature
1076
+
1077
+ ```ts
1078
+ reduce(callbackfn): E;
1079
+ ```
1080
+
1081
+ Defined in: [data-structures/base/iterable-element-base.ts:194](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L194)
1082
+
1083
+ ##### Parameters
1084
+
1085
+ ###### callbackfn
1086
+
1087
+ `ReduceElementCallback`\<`E`, `R`\>
1088
+
1089
+ ##### Returns
1090
+
1091
+ `E`
1092
+
1093
+ ##### Inherited from
1094
+
1095
+ [`IterableElementBase`](IterableElementBase.md).[`reduce`](IterableElementBase.md#reduce)
1096
+
1097
+ #### Call Signature
1098
+
1099
+ ```ts
1100
+ reduce(callbackfn, initialValue): E;
1101
+ ```
1102
+
1103
+ Defined in: [data-structures/base/iterable-element-base.ts:195](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L195)
1104
+
1105
+ ##### Parameters
1106
+
1107
+ ###### callbackfn
1108
+
1109
+ `ReduceElementCallback`\<`E`, `R`\>
1110
+
1111
+ ###### initialValue
1112
+
1113
+ `E`
1114
+
1115
+ ##### Returns
1116
+
1117
+ `E`
1118
+
1119
+ ##### Inherited from
1120
+
1121
+ [`IterableElementBase`](IterableElementBase.md).[`reduce`](IterableElementBase.md#reduce)
1122
+
1123
+ #### Call Signature
1124
+
1125
+ ```ts
1126
+ reduce<U>(callbackfn, initialValue): U;
1127
+ ```
1128
+
1129
+ Defined in: [data-structures/base/iterable-element-base.ts:196](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L196)
1130
+
1131
+ ##### Type Parameters
1132
+
1133
+ ###### U
1134
+
1135
+ `U`
1136
+
1137
+ ##### Parameters
1138
+
1139
+ ###### callbackfn
1140
+
1141
+ `ReduceElementCallback`\<`E`, `R`, `U`\>
1142
+
1143
+ ###### initialValue
1144
+
1145
+ `U`
1146
+
1147
+ ##### Returns
1148
+
1149
+ `U`
1150
+
1151
+ ##### Inherited from
1152
+
1153
+ [`IterableElementBase`](IterableElementBase.md).[`reduce`](IterableElementBase.md#reduce)
1154
+
1155
+ ***
1156
+
1157
+ ### reduceRight()
1158
+
1159
+ ```ts
1160
+ reduceRight<U>(callbackfn, initialValue): U;
1161
+ ```
1162
+
1163
+ Defined in: [data-structures/base/linear-base.ts:256](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L256)
1164
+
1165
+ Right-to-left reduction over elements.
1166
+
1167
+ #### Type Parameters
1168
+
1169
+ ##### U
1170
+
1171
+ `U`
1172
+
1173
+ #### Parameters
1174
+
1175
+ ##### callbackfn
1176
+
1177
+ `ReduceLinearCallback`\<`E`, `U`\>
1178
+
1179
+ `(acc, element, index, self) => acc`.
1180
+
1181
+ ##### initialValue
1182
+
1183
+ `U`
1184
+
1185
+ Initial accumulator (optional generic overloads supported).
1186
+
1187
+ #### Returns
1188
+
1189
+ `U`
1190
+
1191
+ Final accumulator.
1192
+
1193
+ #### Remarks
1194
+
1195
+ Time O(n), Space O(1)
1196
+
1197
+ ***
1198
+
1199
+ ### reverse()
1200
+
1201
+ ```ts
1202
+ abstract reverse(): this;
1203
+ ```
1204
+
1205
+ Defined in: [data-structures/base/linear-base.ts:328](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L328)
1206
+
1207
+ Reverse the order of elements in-place (or equivalent).
1208
+
1209
+ #### Returns
1210
+
1211
+ `this`
1212
+
1213
+ This list.
1214
+
1215
+ #### Remarks
1216
+
1217
+ Time O(n), Space O(1)
1218
+
1219
+ ***
1220
+
1221
+ ### setAt()
1222
+
1223
+ ```ts
1224
+ abstract setAt(index, value): boolean;
1225
+ ```
1226
+
1227
+ Defined in: [data-structures/base/linear-base.ts:314](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L314)
1228
+
1229
+ Set the value at an index.
1230
+
1231
+ #### Parameters
1232
+
1233
+ ##### index
1234
+
1235
+ `number`
1236
+
1237
+ Position (0-based).
1238
+
1239
+ ##### value
1240
+
1241
+ `E`
1242
+
1243
+ New value.
1244
+
1245
+ #### Returns
1246
+
1247
+ `boolean`
1248
+
1249
+ `true` if updated.
1250
+
1251
+ #### Remarks
1252
+
1253
+ Time O(1) typical, Space O(1)
1254
+
1255
+ ***
1256
+
1257
+ ### slice()
1258
+
1259
+ ```ts
1260
+ slice(start?, end?): this;
1261
+ ```
1262
+
1263
+ Defined in: [data-structures/base/linear-base.ts:273](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L273)
1264
+
1265
+ Create a shallow copy of a subrange.
1266
+
1267
+ #### Parameters
1268
+
1269
+ ##### start?
1270
+
1271
+ `number` = `0`
1272
+
1273
+ Inclusive start (supports negative index).
1274
+
1275
+ ##### end?
1276
+
1277
+ `number` = `...`
1278
+
1279
+ Exclusive end (supports negative index).
1280
+
1281
+ #### Returns
1282
+
1283
+ `this`
1284
+
1285
+ New list with the range (`this` type).
1286
+
1287
+ #### Remarks
1288
+
1289
+ Time O(n), Space O(n)
1290
+
1291
+ ***
1292
+
1293
+ ### some()
1294
+
1295
+ ```ts
1296
+ some(predicate, thisArg?): boolean;
1297
+ ```
1298
+
1299
+ Defined in: [data-structures/base/iterable-element-base.ts:110](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L110)
1300
+
1301
+ Tests whether at least one element satisfies the predicate.
1302
+
1303
+ #### Parameters
1304
+
1305
+ ##### predicate
1306
+
1307
+ `ElementCallback`\<`E`, `R`, `boolean`\>
1308
+
1309
+ Function invoked for each element with signature `(value, index, self)`.
1310
+
1311
+ ##### thisArg?
1312
+
1313
+ `unknown`
1314
+
1315
+ Optional `this` binding for the predicate.
1316
+
1317
+ #### Returns
1318
+
1319
+ `boolean`
1320
+
1321
+ `true` if any element passes; otherwise `false`.
1322
+
1323
+ #### Remarks
1324
+
1325
+ Time O(n) in the worst case; may exit early on first success. Space O(1).
1326
+
1327
+ #### Inherited from
1328
+
1329
+ [`IterableElementBase`](IterableElementBase.md).[`some`](IterableElementBase.md#some)
1330
+
1331
+ ***
1332
+
1333
+ ### sort()
1334
+
1335
+ ```ts
1336
+ sort(compareFn?): this;
1337
+ ```
1338
+
1339
+ Defined in: [data-structures/base/linear-base.ts:185](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L185)
1340
+
1341
+ In-place stable order via array sort semantics.
1342
+
1343
+ #### Parameters
1344
+
1345
+ ##### compareFn?
1346
+
1347
+ (`a`, `b`) => `number`
1348
+
1349
+ Comparator `(a, b) => number`.
1350
+
1351
+ #### Returns
1352
+
1353
+ `this`
1354
+
1355
+ This container.
1356
+
1357
+ #### Remarks
1358
+
1359
+ Time O(n log n), Space O(n) (materializes to array temporarily)
1360
+
1361
+ ***
1362
+
1363
+ ### splice()
1364
+
1365
+ ```ts
1366
+ splice(
1367
+ start,
1368
+ deleteCount?, ...
1369
+ items): this;
1370
+ ```
1371
+
1372
+ Defined in: [data-structures/base/linear-base.ts:201](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L201)
1373
+
1374
+ Remove and/or insert elements at a position (array-compatible).
1375
+
1376
+ #### Parameters
1377
+
1378
+ ##### start
1379
+
1380
+ `number`
1381
+
1382
+ Start index (supports negative index).
1383
+
1384
+ ##### deleteCount?
1385
+
1386
+ `number` = `0`
1387
+
1388
+ How many to remove.
1389
+
1390
+ ##### items
1391
+
1392
+ ...`E`[]
1393
+
1394
+ Elements to insert.
1395
+
1396
+ #### Returns
1397
+
1398
+ `this`
1399
+
1400
+ Removed elements as a new list (`this` type).
1401
+
1402
+ #### Remarks
1403
+
1404
+ Time O(n + m), Space O(min(n, m)) where `m = items.length`
1405
+
1406
+ ***
1407
+
1408
+ ### toArray()
1409
+
1410
+ ```ts
1411
+ toArray(): E[];
1412
+ ```
1413
+
1414
+ Defined in: [data-structures/base/iterable-element-base.ts:246](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L246)
1415
+
1416
+ Materializes the elements into a new array.
1417
+
1418
+ #### Returns
1419
+
1420
+ `E`[]
1421
+
1422
+ A shallow array copy of the iteration order.
1423
+
1424
+ #### Remarks
1425
+
1426
+ Time O(n), Space O(n).
1427
+
1428
+ #### Inherited from
1429
+
1430
+ [`IterableElementBase`](IterableElementBase.md).[`toArray`](IterableElementBase.md#toarray)
1431
+
1432
+ ***
1433
+
1434
+ ### toReversedArray()
1435
+
1436
+ ```ts
1437
+ toReversedArray(): E[];
1438
+ ```
1439
+
1440
+ Defined in: [data-structures/base/linear-base.ts:237](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L237)
1441
+
1442
+ Snapshot elements into a reversed array.
1443
+
1444
+ #### Returns
1445
+
1446
+ `E`[]
1447
+
1448
+ New reversed array.
1449
+
1450
+ #### Remarks
1451
+
1452
+ Time O(n), Space O(n)
1453
+
1454
+ ***
1455
+
1456
+ ### toVisual()
1457
+
1458
+ ```ts
1459
+ toVisual(): E[];
1460
+ ```
1461
+
1462
+ Defined in: [data-structures/base/iterable-element-base.ts:258](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L258)
1463
+
1464
+ Returns a representation of the structure suitable for quick visualization.
1465
+ Defaults to an array of elements; subclasses may override to provide richer visuals.
1466
+
1467
+ #### Returns
1468
+
1469
+ `E`[]
1470
+
1471
+ A visual representation (array by default).
1472
+
1473
+ #### Remarks
1474
+
1475
+ Time O(n), Space O(n).
1476
+
1477
+ #### Inherited from
1478
+
1479
+ [`IterableElementBase`](IterableElementBase.md).[`toVisual`](IterableElementBase.md#tovisual)
1480
+
1481
+ ***
1482
+
1483
+ ### values()
1484
+
1485
+ ```ts
1486
+ values(): IterableIterator<E>;
1487
+ ```
1488
+
1489
+ Defined in: [data-structures/base/iterable-element-base.ts:72](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L72)
1490
+
1491
+ Returns an iterator over the values (alias of the default iterator).
1492
+
1493
+ #### Returns
1494
+
1495
+ `IterableIterator`\<`E`\>
1496
+
1497
+ An `IterableIterator<E>` over all elements.
1498
+
1499
+ #### Remarks
1500
+
1501
+ Creating the iterator is O(1); full iteration is Time O(n), Space O(1).
1502
+
1503
+ #### Inherited from
1504
+
1505
+ [`IterableElementBase`](IterableElementBase.md).[`values`](IterableElementBase.md#values)
1506
+
1507
+
1508
+ ---
1509
+
1510
+ ## Protected Members
1511
+
1512
+ ### \_toElementFn?
1513
+
1514
+ ```ts
1515
+ protected optional _toElementFn?: (rawElement) => E;
1516
+ ```
1517
+
1518
+ Defined in: [data-structures/base/iterable-element-base.ts:39](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L39)
1519
+
1520
+ The converter used to transform a raw element (`R`) into a public element (`E`).
1521
+
1522
+ #### Parameters
1523
+
1524
+ ##### rawElement
1525
+
1526
+ `R`
1527
+
1528
+ #### Returns
1529
+
1530
+ `E`
1531
+
1532
+ #### Remarks
1533
+
1534
+ Time O(1), Space O(1).
1535
+
1536
+ #### Inherited from
1537
+
1538
+ [`IterableElementBase`](IterableElementBase.md).[`_toElementFn`](IterableElementBase.md#_toelementfn)
1539
+
1540
+ ## Accessors
1541
+
1542
+ ### \_createInstance()
1543
+
1544
+ ```ts
1545
+ abstract protected _createInstance(options?): this;
1546
+ ```
1547
+
1548
+ Defined in: [data-structures/base/linear-base.ts:385](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L385)
1549
+
1550
+ Create an empty list of the same species.
1551
+
1552
+ #### Parameters
1553
+
1554
+ ##### options?
1555
+
1556
+ `LinearBaseOptions`\<`E`, `R`\>
1557
+
1558
+ Runtime options to carry.
1559
+
1560
+ #### Returns
1561
+
1562
+ `this`
1563
+
1564
+ Empty list (`this` type).
1565
+
1566
+ #### Remarks
1567
+
1568
+ Time O(1), Space O(1)
1569
+
1570
+ ***
1571
+
1572
+ ### \_getIterator()
1573
+
1574
+ ```ts
1575
+ abstract protected _getIterator(...args): IterableIterator<E>;
1576
+ ```
1577
+
1578
+ Defined in: [data-structures/base/iterable-element-base.ts:352](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L352)
1579
+
1580
+ Internal iterator factory used by the default iterator.
1581
+
1582
+ #### Parameters
1583
+
1584
+ ##### args
1585
+
1586
+ ...`unknown`[]
1587
+
1588
+ Optional iterator arguments.
1589
+
1590
+ #### Returns
1591
+
1592
+ `IterableIterator`\<`E`\>
1593
+
1594
+ An iterator over elements.
1595
+
1596
+ #### Remarks
1597
+
1598
+ Implementations should yield in O(1) per element with O(1) extra space when possible.
1599
+
1600
+ #### Inherited from
1601
+
1602
+ [`IterableElementBase`](IterableElementBase.md).[`_getIterator`](IterableElementBase.md#_getiterator)
1603
+
1604
+ ***
1605
+
1606
+ ### \_getReverseIterator()
1607
+
1608
+ ```ts
1609
+ abstract protected _getReverseIterator(...args): IterableIterator<E>;
1610
+ ```
1611
+
1612
+ Defined in: [data-structures/base/linear-base.ts:392](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L392)
1613
+
1614
+ Reverse-direction iterator over elements.
1615
+
1616
+ #### Parameters
1617
+
1618
+ ##### args
1619
+
1620
+ ...`unknown`[]
1621
+
1622
+ #### Returns
1623
+
1624
+ `IterableIterator`\<`E`\>
1625
+
1626
+ Iterator of elements from tail to head.
1627
+
1628
+ #### Remarks
1629
+
1630
+ Time O(n), Space O(1)
1631
+
1632
+ ***