data-structure-typed 2.5.2 → 2.5.3

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 (156) hide show
  1. package/CHANGELOG.md +3 -1
  2. package/MIGRATION.md +169 -0
  3. package/README.md +60 -6
  4. package/README_CN.md +551 -143
  5. package/SPECIFICATION.md +20 -14
  6. package/SPECIFICATION.zh-CN.md +20 -14
  7. package/dist/cjs/binary-tree.cjs +2417 -132
  8. package/dist/cjs/graph.cjs +248 -14
  9. package/dist/cjs/hash.cjs +62 -7
  10. package/dist/cjs/heap.cjs +103 -16
  11. package/dist/cjs/index.cjs +3046 -124
  12. package/dist/cjs/linked-list.cjs +219 -0
  13. package/dist/cjs/matrix.cjs +32 -0
  14. package/dist/cjs/priority-queue.cjs +101 -14
  15. package/dist/cjs/queue.cjs +215 -0
  16. package/dist/cjs/stack.cjs +44 -4
  17. package/dist/cjs/trie.cjs +44 -0
  18. package/dist/cjs-legacy/binary-tree.cjs +2406 -123
  19. package/dist/cjs-legacy/graph.cjs +248 -14
  20. package/dist/cjs-legacy/hash.cjs +62 -7
  21. package/dist/cjs-legacy/heap.cjs +103 -16
  22. package/dist/cjs-legacy/index.cjs +3105 -185
  23. package/dist/cjs-legacy/linked-list.cjs +219 -0
  24. package/dist/cjs-legacy/matrix.cjs +32 -0
  25. package/dist/cjs-legacy/priority-queue.cjs +101 -14
  26. package/dist/cjs-legacy/queue.cjs +215 -0
  27. package/dist/cjs-legacy/stack.cjs +44 -4
  28. package/dist/cjs-legacy/trie.cjs +44 -0
  29. package/dist/esm/binary-tree.mjs +2417 -132
  30. package/dist/esm/graph.mjs +248 -14
  31. package/dist/esm/hash.mjs +62 -7
  32. package/dist/esm/heap.mjs +103 -16
  33. package/dist/esm/index.mjs +3046 -124
  34. package/dist/esm/linked-list.mjs +219 -0
  35. package/dist/esm/matrix.mjs +32 -0
  36. package/dist/esm/priority-queue.mjs +101 -14
  37. package/dist/esm/queue.mjs +215 -0
  38. package/dist/esm/stack.mjs +44 -4
  39. package/dist/esm/trie.mjs +44 -0
  40. package/dist/esm-legacy/binary-tree.mjs +2406 -123
  41. package/dist/esm-legacy/graph.mjs +248 -14
  42. package/dist/esm-legacy/hash.mjs +62 -7
  43. package/dist/esm-legacy/heap.mjs +103 -16
  44. package/dist/esm-legacy/index.mjs +3105 -185
  45. package/dist/esm-legacy/linked-list.mjs +219 -0
  46. package/dist/esm-legacy/matrix.mjs +32 -0
  47. package/dist/esm-legacy/priority-queue.mjs +101 -14
  48. package/dist/esm-legacy/queue.mjs +215 -0
  49. package/dist/esm-legacy/stack.mjs +44 -4
  50. package/dist/esm-legacy/trie.mjs +44 -0
  51. package/dist/types/data-structures/binary-tree/avl-tree.d.ts +50 -2
  52. package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +56 -0
  53. package/dist/types/data-structures/binary-tree/binary-tree.d.ts +116 -15
  54. package/dist/types/data-structures/binary-tree/bst.d.ts +99 -3
  55. package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +79 -8
  56. package/dist/types/data-structures/binary-tree/segment-tree.d.ts +24 -0
  57. package/dist/types/data-structures/binary-tree/tree-map.d.ts +520 -1
  58. package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +489 -1
  59. package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +393 -1
  60. package/dist/types/data-structures/binary-tree/tree-set.d.ts +500 -1
  61. package/dist/types/data-structures/graph/directed-graph.d.ts +40 -0
  62. package/dist/types/data-structures/graph/undirected-graph.d.ts +36 -0
  63. package/dist/types/data-structures/hash/hash-map.d.ts +51 -6
  64. package/dist/types/data-structures/heap/heap.d.ts +98 -12
  65. package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +75 -0
  66. package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +61 -1
  67. package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +72 -0
  68. package/dist/types/data-structures/matrix/matrix.d.ts +32 -0
  69. package/dist/types/data-structures/queue/deque.d.ts +82 -0
  70. package/dist/types/data-structures/queue/queue.d.ts +61 -0
  71. package/dist/types/data-structures/stack/stack.d.ts +42 -2
  72. package/dist/types/data-structures/trie/trie.d.ts +48 -0
  73. package/dist/types/interfaces/binary-tree.d.ts +2 -3
  74. package/dist/umd/data-structure-typed.js +3105 -185
  75. package/dist/umd/data-structure-typed.min.js +4 -4
  76. package/docs-site-docusaurus/docs/api/classes/AVLTree.md +188 -200
  77. package/docs-site-docusaurus/docs/api/classes/AVLTreeNode.md +11 -11
  78. package/docs-site-docusaurus/docs/api/classes/AbstractGraph.md +62 -62
  79. package/docs-site-docusaurus/docs/api/classes/BST.md +183 -195
  80. package/docs-site-docusaurus/docs/api/classes/BSTNode.md +13 -13
  81. package/docs-site-docusaurus/docs/api/classes/BinaryIndexedTree.md +15 -15
  82. package/docs-site-docusaurus/docs/api/classes/BinaryTree.md +143 -155
  83. package/docs-site-docusaurus/docs/api/classes/BinaryTreeNode.md +13 -13
  84. package/docs-site-docusaurus/docs/api/classes/Deque.md +99 -85
  85. package/docs-site-docusaurus/docs/api/classes/DirectedGraph.md +73 -73
  86. package/docs-site-docusaurus/docs/api/classes/DoublyLinkedList.md +100 -70
  87. package/docs-site-docusaurus/docs/api/classes/DoublyLinkedListNode.md +8 -8
  88. package/docs-site-docusaurus/docs/api/classes/FibonacciHeap.md +12 -12
  89. package/docs-site-docusaurus/docs/api/classes/FibonacciHeapNode.md +1 -1
  90. package/docs-site-docusaurus/docs/api/classes/HashMap.md +38 -38
  91. package/docs-site-docusaurus/docs/api/classes/Heap.md +96 -85
  92. package/docs-site-docusaurus/docs/api/classes/IterableElementBase.md +25 -25
  93. package/docs-site-docusaurus/docs/api/classes/IterableEntryBase.md +23 -23
  94. package/docs-site-docusaurus/docs/api/classes/LinearBase.md +48 -48
  95. package/docs-site-docusaurus/docs/api/classes/LinearLinkedBase.md +52 -52
  96. package/docs-site-docusaurus/docs/api/classes/LinkedHashMap.md +42 -42
  97. package/docs-site-docusaurus/docs/api/classes/LinkedListNode.md +6 -6
  98. package/docs-site-docusaurus/docs/api/classes/LinkedListQueue.md +74 -74
  99. package/docs-site-docusaurus/docs/api/classes/MapGraph.md +73 -73
  100. package/docs-site-docusaurus/docs/api/classes/Matrix.md +31 -31
  101. package/docs-site-docusaurus/docs/api/classes/MaxHeap.md +104 -89
  102. package/docs-site-docusaurus/docs/api/classes/MaxPriorityQueue.md +104 -89
  103. package/docs-site-docusaurus/docs/api/classes/MinHeap.md +104 -89
  104. package/docs-site-docusaurus/docs/api/classes/MinPriorityQueue.md +104 -89
  105. package/docs-site-docusaurus/docs/api/classes/Navigator.md +5 -5
  106. package/docs-site-docusaurus/docs/api/classes/PriorityQueue.md +103 -88
  107. package/docs-site-docusaurus/docs/api/classes/Queue.md +111 -59
  108. package/docs-site-docusaurus/docs/api/classes/RedBlackTree.md +200 -212
  109. package/docs-site-docusaurus/docs/api/classes/SegmentTree.md +10 -10
  110. package/docs-site-docusaurus/docs/api/classes/SinglyLinkedList.md +75 -75
  111. package/docs-site-docusaurus/docs/api/classes/SinglyLinkedListNode.md +6 -6
  112. package/docs-site-docusaurus/docs/api/classes/SkipList.md +37 -37
  113. package/docs-site-docusaurus/docs/api/classes/Stack.md +42 -42
  114. package/docs-site-docusaurus/docs/api/classes/TreeMap.md +107 -36
  115. package/docs-site-docusaurus/docs/api/classes/TreeMultiMap.md +43 -43
  116. package/docs-site-docusaurus/docs/api/classes/TreeSet.md +106 -35
  117. package/docs-site-docusaurus/docs/api/classes/Trie.md +43 -43
  118. package/docs-site-docusaurus/docs/api/classes/TrieNode.md +8 -8
  119. package/docs-site-docusaurus/docs/api/classes/UndirectedGraph.md +72 -72
  120. package/docs-site-docusaurus/docs/guide/architecture.md +75 -7
  121. package/docs-site-docusaurus/docs/guide/concepts.md +53 -34
  122. package/docs-site-docusaurus/docs/guide/faq.md +53 -0
  123. package/docs-site-docusaurus/docs/guide/guides.md +8 -9
  124. package/docs-site-docusaurus/docs/guide/integrations.md +74 -177
  125. package/docs-site-docusaurus/docs/guide/overview.md +131 -17
  126. package/docs-site-docusaurus/src/pages/index.tsx +4 -0
  127. package/docs-site-docusaurus/typedoc.json +1 -0
  128. package/package.json +7 -6
  129. package/src/data-structures/binary-tree/avl-tree.ts +52 -5
  130. package/src/data-structures/binary-tree/binary-indexed-tree.ts +56 -0
  131. package/src/data-structures/binary-tree/binary-tree.ts +167 -81
  132. package/src/data-structures/binary-tree/bst.ts +101 -7
  133. package/src/data-structures/binary-tree/red-black-tree.ts +82 -15
  134. package/src/data-structures/binary-tree/segment-tree.ts +24 -0
  135. package/src/data-structures/binary-tree/tree-map.ts +540 -3
  136. package/src/data-structures/binary-tree/tree-multi-map.ts +490 -2
  137. package/src/data-structures/binary-tree/tree-multi-set.ts +393 -1
  138. package/src/data-structures/binary-tree/tree-set.ts +520 -3
  139. package/src/data-structures/graph/directed-graph.ts +41 -1
  140. package/src/data-structures/graph/undirected-graph.ts +37 -1
  141. package/src/data-structures/hash/hash-map.ts +67 -12
  142. package/src/data-structures/heap/heap.ts +107 -19
  143. package/src/data-structures/linked-list/doubly-linked-list.ts +88 -0
  144. package/src/data-structures/linked-list/singly-linked-list.ts +61 -1
  145. package/src/data-structures/linked-list/skip-linked-list.ts +72 -0
  146. package/src/data-structures/matrix/matrix.ts +32 -0
  147. package/src/data-structures/queue/deque.ts +85 -0
  148. package/src/data-structures/queue/queue.ts +73 -0
  149. package/src/data-structures/stack/stack.ts +45 -5
  150. package/src/data-structures/trie/trie.ts +48 -0
  151. package/src/interfaces/binary-tree.ts +1 -9
  152. package/.vitepress/cache/deps_temp_51f5f1b0/chunk-7OIKW5WK.js +0 -12984
  153. package/.vitepress/cache/deps_temp_51f5f1b0/package.json +0 -3
  154. package/.vitepress/cache/deps_temp_51f5f1b0/vitepress___@vue_devtools-api.js +0 -4505
  155. package/.vitepress/cache/deps_temp_51f5f1b0/vitepress___@vueuse_core.js +0 -9731
  156. package/.vitepress/cache/deps_temp_51f5f1b0/vue.js +0 -347
package/CHANGELOG.md CHANGED
@@ -8,7 +8,9 @@ All notable changes to this project will be documented in this file.
8
8
  - [Semantic Versioning](https://semver.org/spec/v2.0.0.html)
9
9
  - [`auto-changelog`](https://github.com/CookPete/auto-changelog)
10
10
 
11
- ## [v2.5.2](https://github.com/zrwusa/data-structure-typed/compare/v2.5.1...main) (upcoming)
11
+ ## [v2.5.3](https://github.com/zrwusa/data-structure-typed/compare/v2.5.3...main) (upcoming)
12
+
13
+ ## [v2.5.3](https://github.com/zrwusa/data-structure-typed/compare/v2.5.1...v2.5.3) (31 March 2026)
12
14
 
13
15
  ## [v2.5.1](https://github.com/zrwusa/data-structure-typed/compare/v2.5.0...v2.5.1) (28 March 2026)
14
16
 
package/MIGRATION.md ADDED
@@ -0,0 +1,169 @@
1
+ # Migration Guide
2
+
3
+ ## Upgrading to v2.5.3
4
+
5
+ ### Breaking Changes
6
+
7
+ #### 1. `HashMap/LinkedHashMap.set()` returns `this` instead of `boolean`
8
+
9
+ Aligns with the native JS `Map.set()` spec. Enables chaining.
10
+
11
+ ```typescript
12
+ // Before
13
+ const success: boolean = map.set('key', 'value');
14
+
15
+ // After
16
+ map.set('key', 'value'); // returns this
17
+ const chain = map.set('a', 1).set('b', 2); // chaining works
18
+ ```
19
+
20
+ #### 2. `BinaryTree/BST/AVL/RedBlackTree.delete()` returns `boolean` instead of `BinaryTreeDeleteResult[]`
21
+
22
+ Simplified to match standard container semantics.
23
+
24
+ ```typescript
25
+ // Before
26
+ const results: BinaryTreeDeleteResult[] = tree.delete(key);
27
+ const success = results.length > 0 && results[0].deleted !== undefined;
28
+
29
+ // After
30
+ const success: boolean = tree.delete(key); // true if found and removed
31
+ ```
32
+
33
+ #### 3. `BST.deleteWhere()` returns `boolean` instead of `BinaryTreeDeleteResult[]`
34
+
35
+ ```typescript
36
+ // Before
37
+ const results: BinaryTreeDeleteResult[] = bst.deleteWhere(pred);
38
+
39
+ // After
40
+ const deleted: boolean = bst.deleteWhere(pred); // true if any match removed
41
+ ```
42
+
43
+ #### 4. `Stack.deleteAt()` returns `E | undefined` instead of `boolean`
44
+
45
+ Consistent with `LinkedList.deleteAt()`, `Queue.deleteAt()`, `Deque.deleteAt()`.
46
+
47
+ ```typescript
48
+ // Before
49
+ const success: boolean = stack.deleteAt(2);
50
+
51
+ // After
52
+ const removed: E | undefined = stack.deleteAt(2); // returns removed element
53
+ if (removed !== undefined) { /* success */ }
54
+ ```
55
+
56
+ #### 5. `LinkedHashMap.deleteAt()` returns `[K, V] | undefined` instead of `boolean`
57
+
58
+ ```typescript
59
+ // Before
60
+ const success: boolean = lhm.deleteAt(0);
61
+
62
+ // After
63
+ const entry: [K, V] | undefined = lhm.deleteAt(0);
64
+ if (entry) {
65
+ const [key, value] = entry;
66
+ }
67
+ ```
68
+
69
+ #### 6. `FibonacciHeap.push()` returns `boolean` instead of `this`
70
+
71
+ Consistent with `Heap.add()`.
72
+
73
+ ```typescript
74
+ // Before
75
+ const heap: FibonacciHeap = fh.push(42); // returned this
76
+
77
+ // After
78
+ const success: boolean = fh.push(42); // returns true
79
+ ```
80
+
81
+ #### 7. `refill()` removed from `BinaryTree` and `Heap`
82
+
83
+ Replace with `clear()` + `addMany()`/`setMany()`.
84
+
85
+ ```typescript
86
+ // Before (Heap)
87
+ heap.refill([5, 3, 1, 4]);
88
+
89
+ // After (Heap)
90
+ heap.clear();
91
+ heap.addMany([5, 3, 1, 4]);
92
+
93
+ // Before (BinaryTree)
94
+ tree.refill(entries);
95
+
96
+ // After (BinaryTree)
97
+ tree.clear();
98
+ tree.setMany(entries);
99
+ ```
100
+
101
+ ---
102
+
103
+ ### Deprecations
104
+
105
+ These still work but will be removed in a future major version.
106
+
107
+ #### `Heap.poll()` → use `Heap.pop()`
108
+
109
+ ```typescript
110
+ // Deprecated
111
+ const top = heap.poll();
112
+
113
+ // Preferred
114
+ const top = heap.pop();
115
+ ```
116
+
117
+ #### `Heap.deleteBy()` → use `Heap.deleteWhere()`
118
+
119
+ ```typescript
120
+ // Deprecated
121
+ heap.deleteBy(e => e.id === 42);
122
+
123
+ // Preferred
124
+ heap.deleteWhere(e => e.id === 42);
125
+ ```
126
+
127
+ ---
128
+
129
+ ### New Features
130
+
131
+ #### `deleteWhere()` — conditional deletion
132
+
133
+ Available on: `TreeMap`, `TreeSet`, `TreeMultiMap`, `TreeMultiSet`, `DoublyLinkedList`, `Queue`, `Heap`
134
+
135
+ ```typescript
136
+ // Delete first even number from queue
137
+ queue.deleteWhere((value, index) => value % 2 === 0);
138
+
139
+ // Delete entries where value > 100 from TreeMap
140
+ treeMap.deleteWhere((key, value) => value > 100);
141
+
142
+ // Delete keys > 50 from TreeSet
143
+ treeSet.deleteWhere((key) => key > 50);
144
+ ```
145
+
146
+ #### `Queue.peek()` / `Deque.peek()`
147
+
148
+ Alias for the `first` getter. Familiar API for users coming from other languages.
149
+
150
+ ```typescript
151
+ const queue = new Queue([10, 20, 30]);
152
+ queue.peek(); // 10 (same as queue.first)
153
+ queue.first; // 10
154
+
155
+ const deque = new Deque([10, 20, 30]);
156
+ deque.peek(); // 10 (same as deque.first)
157
+ ```
158
+
159
+ #### `Heap.pop()` — primary top-removal method
160
+
161
+ Consistent naming across all containers (`Stack.pop()`, `Deque.pop()`, `Heap.pop()`).
162
+
163
+ ```typescript
164
+ const heap = new Heap([3, 1, 4], { comparator: (a, b) => a - b });
165
+ heap.pop(); // 1 (min element)
166
+ heap.pop(); // 3
167
+ heap.pop(); // 4
168
+ heap.pop(); // undefined
169
+ ```
package/README.md CHANGED
@@ -83,10 +83,10 @@ npm i avl-tree-typed bst-typed heap-typed
83
83
 
84
84
  Try it instantly:
85
85
 
86
- - [Node.js TypeScript](https://stackblitz.com/edit/stackblitz-starters-e1vdy3zw?file=src%2Findex.ts)
87
- - [Node.js JavaScript](https://stackblitz.com/edit/stackblitz-starters-oczhrfzn?file=src%2Findex.js)
88
- - [React TypeScript](https://stackblitz.com/edit/vitejs-vite-7bva1zhd?file=src%2FApp.tsx)
89
- - [NestJS](https://stackblitz.com/edit/nestjs-typescript-starter-q9n7okgc?file=src%2Fproduct%2Fservices%2Fproduct-price-index.service.ts)
86
+ - [Node.js TypeScript](https://stackblitz.com/github/zrwusa/dst-playgrounds/tree/main/apps/nodejs-ts?file=src%2Findex.ts&title=data-structure-typed%20%E2%80%94%20Node.js%20TypeScript)
87
+ - [Node.js JavaScript](https://stackblitz.com/github/zrwusa/dst-playgrounds/tree/main/apps/nodejs-js?file=src%2Findex.js&title=data-structure-typed%20%E2%80%94%20Node.js%20JavaScript)
88
+ - [React TypeScript](https://stackblitz.com/github/zrwusa/dst-playgrounds/tree/main/apps/reactjs?file=src%2FApp.tsx&title=data-structure-typed%20%E2%80%94%20React%20Playground)
89
+ - [NestJS](https://stackblitz.com/github/zrwusa/dst-playgrounds/tree/main/apps/nestjs?file=src%2Fproduct%2Fservices%2Fproduct-price-index.service.ts&title=data-structure-typed%20%E2%80%94%20NestJS%20Product%20API)
90
90
 
91
91
  ---
92
92
 
@@ -216,7 +216,7 @@ const value = tree.get(1); // Type: string | undefined
216
216
 
217
217
  ### ✨ Zero Friction
218
218
 
219
- Works everywhere. Spread it `[...]`, loop it `for..of`, convert it instantly.
219
+ Works everywhere. Spread it `[...]`, loop it `for..of`, convert it instantly. Pass raw data with `toEntryFn`/`toElementFn` — no pre-processing needed.
220
220
 
221
221
  ```javascript
222
222
  // All data structures work with iterator protocol
@@ -225,8 +225,51 @@ const sorted = [...tree]; // Spread operator
225
225
  for (const item of tree) {
226
226
  } // for...of loop
227
227
  const set = new Set(tree); // Set constructor
228
+
229
+ // Pass raw data directly
230
+ const map = new TreeMap(users, { toEntryFn: u => [u.id, u.name] });
228
231
  ```
229
232
 
233
+ ### 🔄 Working with Raw Data
234
+
235
+ Got raw objects? Three ways to use them — pick based on what you want to store:
236
+
237
+ ```typescript
238
+ interface User {
239
+ id: number;
240
+ name: string;
241
+ }
242
+
243
+ const users: User[] = [
244
+ { id: 3, name: 'Charlie' },
245
+ { id: 1, name: 'Alice' },
246
+ { id: 2, name: 'Bob' }
247
+ ];
248
+
249
+ // 1. Extract a field — store only that field
250
+ const ids = new TreeSet<number, User>(
251
+ users,
252
+ { toElementFn: u => u.id }
253
+ );
254
+ // [1, 2, 3] — numbers only, original objects not kept
255
+
256
+ // 2. Store full objects — sort by a field
257
+ const fullSet = new TreeSet<User>(
258
+ users,
259
+ { comparator: (a, b) => a.id - b.id }
260
+ );
261
+ // [{ id: 1, name: 'Alice' }, { id: 2, ... }, { id: 3, ... }]
262
+
263
+ // 3. Split into key-value — field as key, anything as value
264
+ const map = new TreeMap<number, User, User>(
265
+ users,
266
+ { toEntryFn: u => [u.id, u] }
267
+ );
268
+ // map.get(1) → { id: 1, name: 'Alice' }
269
+ ```
270
+
271
+ Works across all data structures — `toElementFn` for single-value types (Heap, Queue, Stack, LinkedList, Trie), `toEntryFn` for key-value types (TreeMap, HashMap, SkipList), and `comparator` for any sorted structure.
272
+
230
273
  ---
231
274
 
232
275
  ## 💡 When Should I Consider This Library?
@@ -238,6 +281,7 @@ const set = new Set(tree); // Set constructor
238
281
  - Priority queues with fast position-based access
239
282
  - Time-series data with range queries
240
283
  - Red-Black Tree / Heap performance without learning new APIs
284
+ - **Pass raw objects directly** — no `.map()` pre-processing needed (unique to this library in JS/TS)
241
285
 
242
286
  ✅ **When your current code has:**
243
287
 
@@ -246,6 +290,7 @@ const set = new Set(tree); // Set constructor
246
290
  - `Array.shift()` on large lists (queues)
247
291
  - Custom sorting logic you repeat across files
248
292
  - Map that needs to be ordered
293
+ - `.map()` calls just to reshape data before putting it in a collection
249
294
 
250
295
  ---
251
296
 
@@ -314,7 +359,7 @@ const taskQueue = new MaxPriorityQueue<{priority: number; task: string}>([], {
314
359
  taskQueue.add({ priority: 5, task: 'Email' });
315
360
  taskQueue.add({ priority: 9, task: 'Alert' }); // Instant priority handling
316
361
 
317
- const nextTask = taskQueue.poll(); // { priority: 9, task: 'Alert' }
362
+ const nextTask = taskQueue.pop(); // { priority: 9, task: 'Alert' }
318
363
  ```
319
364
 
320
365
  ### Fast Queue (FIFO)
@@ -701,6 +746,15 @@ Yes. 2600+ tests, 99%+ code coverage, zero dependencies, and used in production.
701
746
 
702
747
  `data-structure-typed` offers more data structures (20+), a unified Array-like API across all structures, tree-shakeable subpath exports, and active maintenance. See [PERFORMANCE.md](./docs/PERFORMANCE.md) for benchmark comparisons.
703
748
 
749
+ ### Can I pass raw data without converting it first?
750
+
751
+ Yes. Three patterns:
752
+ - **`toElementFn`** — extract a field, store only that (TreeSet, Heap, Queue, Stack, LinkedList, Trie)
753
+ - **`comparator`** — store full objects, sort by a field (all sorted structures)
754
+ - **`toEntryFn`** — split into key-value pairs (TreeMap, HashMap, SkipList)
755
+
756
+ See the [Raw Data section](#-working-with-raw-data) for examples.
757
+
704
758
  ### What is the bundle size?
705
759
 
706
760
  UMD bundle: ~143KB minified. With subpath imports (e.g., `data-structure-typed/heap`), you only load what you use — as small as 18KB for Stack, 30KB for Heap. `sideEffects: false` enables full tree-shaking.