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
@@ -36,943 +36,273 @@ export type SkipListRangeOptions = {
36
36
  */
37
37
  export declare class SkipList<K = any, V = any, R = [K, V]> extends IterableEntryBase<K, V | undefined> {
38
38
  #private;
39
- constructor(entries?: Iterable<R> | Iterable<[K, V | undefined]>, options?: SkipListOptions<K, V, R>);
40
- /**
41
- * Creates a default comparator supporting number, string, Date, and bigint.
42
- */
43
- static createDefaultComparator<K>(): Comparator<K>;
44
39
  protected _head: SkipListNode<K, V>;
45
40
  protected _level: number;
41
+ constructor(entries?: Iterable<R> | Iterable<[K, V | undefined]>, options?: SkipListOptions<K, V, R>);
46
42
  protected _size: number;
47
- protected _maxLevel: number;
48
- protected _probability: number;
49
43
  get size(): number;
44
+ protected _maxLevel: number;
50
45
  get maxLevel(): number;
46
+ protected _probability: number;
51
47
  get probability(): number;
52
48
  get comparator(): Comparator<K>;
53
49
  /**
54
- * Check if empty
55
-
56
-
57
-
58
-
59
-
60
-
61
-
62
-
63
-
64
-
65
-
66
-
67
-
68
-
69
-
70
-
71
-
72
-
73
-
74
-
75
-
76
-
77
-
78
-
79
-
80
-
81
-
82
-
83
-
84
-
85
-
86
-
87
-
88
-
89
-
90
-
91
-
92
-
93
-
94
- * @example
95
- * // Check if empty
96
- * const sl = new SkipList<number, string>();
97
- * console.log(sl.isEmpty()); // true;
98
- */
50
+ * Creates a default comparator supporting number, string, Date, and bigint.
51
+ */
52
+ static createDefaultComparator<K>(): Comparator<K>;
53
+ /**
54
+ * Check if empty
55
+ * @example
56
+ * // Check if empty
57
+ * const sl = new SkipList<number, string>();
58
+ * console.log(sl.isEmpty()); // true;
59
+ */
99
60
  isEmpty(): boolean;
100
61
  /**
101
- * Remove all entries
102
-
103
-
104
-
105
-
106
-
107
-
108
-
109
-
110
-
111
-
112
-
113
-
114
-
115
-
116
-
117
-
118
-
119
-
120
-
121
-
122
-
123
-
124
-
125
-
126
-
127
-
128
-
129
-
130
-
131
-
132
-
133
-
134
-
135
-
136
-
137
-
138
-
139
-
140
-
141
- * @example
142
- * // Remove all entries
143
- * const sl = new SkipList<number, string>([[1, 'a'], [2, 'b']]);
144
- * sl.clear();
145
- * console.log(sl.isEmpty()); // true;
146
- */
62
+ * Remove all entries
63
+ * @example
64
+ * // Remove all entries
65
+ * const sl = new SkipList<number, string>([
66
+ * [1, 'a'],
67
+ * [2, 'b']
68
+ * ]);
69
+ * sl.clear();
70
+ * console.log(sl.isEmpty()); // true;
71
+ */
147
72
  clear(): void;
148
73
  /**
149
- * Create independent copy
150
-
151
-
152
-
153
-
154
-
155
-
156
-
157
-
158
-
159
-
160
-
161
-
162
-
163
-
164
-
165
-
166
-
167
-
168
-
169
-
170
-
171
-
172
-
173
-
174
-
175
-
176
-
177
-
178
-
179
-
180
-
181
-
182
-
183
-
184
-
185
-
186
-
187
-
188
-
189
- * @example
190
- * // Create independent copy
191
- * const sl = new SkipList<number, string>([[1, 'a'], [2, 'b']]);
192
- * const copy = sl.clone();
193
- * copy.delete(1);
194
- * console.log(sl.has(1)); // true;
195
- */
74
+ * Create independent copy
75
+ * @example
76
+ * // Create independent copy
77
+ * const sl = new SkipList<number, string>([
78
+ * [1, 'a'],
79
+ * [2, 'b']
80
+ * ]);
81
+ * const copy = sl.clone();
82
+ * copy.delete(1);
83
+ * console.log(sl.has(1)); // true;
84
+ */
196
85
  clone(): this;
197
86
  /**
198
87
  * Insert or update a key-value pair. Returns `this` for chaining.
199
88
  * Unique keys only — if key exists, value is updated in place.
200
-
201
-
202
-
203
-
204
-
205
-
206
-
207
-
208
-
209
-
210
-
211
-
212
-
213
-
214
-
215
-
216
-
217
-
218
-
219
-
220
-
221
-
222
-
223
-
224
-
225
-
226
-
227
-
228
-
229
-
230
-
231
-
232
-
233
-
234
-
235
-
236
-
237
-
238
-
239
-
240
-
241
-
242
- * @example
243
- * // In-memory sorted key-value store
244
- * const store = new SkipList<number, string>();
245
- *
246
- * store.set(3, 'three');
247
- * store.set(1, 'one');
248
- * store.set(5, 'five');
249
- * store.set(2, 'two');
250
- *
251
- * console.log(store.get(3)); // 'three';
252
- * console.log(store.get(1)); // 'one';
253
- * console.log(store.get(5)); // 'five';
254
- *
255
- * // Update existing key
256
- * store.set(3, 'THREE');
257
- * console.log(store.get(3)); // 'THREE';
89
+ * @example
90
+ * // In-memory sorted key-value store
91
+ * const store = new SkipList<number, string>();
92
+ *
93
+ * store.set(3, 'three');
94
+ * store.set(1, 'one');
95
+ * store.set(5, 'five');
96
+ * store.set(2, 'two');
97
+ *
98
+ * console.log(store.get(3)); // 'three';
99
+ * console.log(store.get(1)); // 'one';
100
+ * console.log(store.get(5)); // 'five';
101
+ *
102
+ * // Update existing key
103
+ * store.set(3, 'THREE');
104
+ * console.log(store.get(3)); // 'THREE';
258
105
  */
259
106
  set(key: K, value: V): this;
260
107
  /**
261
108
  * Get the value for a key, or `undefined` if not found.
262
109
  * Overrides base O(n) with O(log n) skip-list search.
263
-
264
-
265
-
266
-
267
-
268
-
269
-
270
-
271
-
272
-
273
-
274
-
275
-
276
-
277
-
278
-
279
-
280
-
281
-
282
-
283
-
284
-
285
-
286
-
287
-
288
-
289
-
290
-
291
-
292
-
293
-
294
-
295
-
296
-
297
-
298
-
299
-
300
-
301
-
302
-
303
-
304
-
305
- * @example
306
- * // Building a sorted index
307
- * type Product = { id: number; name: string; price: number };
308
- * const products: Product[] = [
309
- * { id: 1, name: 'Widget', price: 25 },
310
- * { id: 2, name: 'Gadget', price: 50 },
311
- * { id: 3, name: 'Doohickey', price: 15 }
312
- * ];
313
- *
314
- * const index = new SkipList<number, Product, Product>(products, {
315
- * toEntryFn: (p: Product) => [p.price, p]
316
- * });
317
- *
318
- * // Iterate in sorted order by price
319
- * const names = [...index.values()].map(p => p!.name);
320
- * console.log(names); // ['Doohickey', 'Widget', 'Gadget'];
321
- *
322
- * // Range search: products between $20 and $60
323
- * const range = index.rangeSearch([20, 60]);
324
- * console.log(range.map(([, p]) => p!.name)); // ['Widget', 'Gadget'];
110
+ * @example
111
+ * // Building a sorted index
112
+ * type Product = { id: number; name: string; price: number };
113
+ * const products: Product[] = [
114
+ * { id: 1, name: 'Widget', price: 25 },
115
+ * { id: 2, name: 'Gadget', price: 50 },
116
+ * { id: 3, name: 'Doohickey', price: 15 }
117
+ * ];
118
+ *
119
+ * const index = new SkipList<number, Product, Product>(products, {
120
+ * toEntryFn: (p: Product) => [p.price, p]
121
+ * });
122
+ *
123
+ * // Iterate in sorted order by price
124
+ * const names = [...index.values()].map(p => p!.name);
125
+ * console.log(names); // ['Doohickey', 'Widget', 'Gadget'];
126
+ *
127
+ * // Range search: products between $20 and $60
128
+ * const range = index.rangeSearch([20, 60]);
129
+ * console.log(range.map(([, p]) => p!.name)); // ['Widget', 'Gadget'];
325
130
  */
326
131
  get(key: K): V | undefined;
327
132
  /**
328
133
  * Check if a key exists.
329
134
  * Overrides base O(n) with O(log n) skip-list search.
330
-
331
-
332
-
333
-
334
-
335
-
336
-
337
-
338
-
339
-
340
-
341
-
342
-
343
-
344
-
345
-
346
-
347
-
348
-
349
-
350
-
351
-
352
-
353
-
354
-
355
-
356
-
357
-
358
-
359
-
360
-
361
-
362
-
363
-
364
-
365
-
366
-
367
-
368
-
369
-
370
-
371
-
372
- * @example
373
- * // Check key existence
374
- * const sl = new SkipList<number, string>([[1, 'a'], [3, 'c'], [5, 'e']]);
375
- * console.log(sl.has(3)); // true;
376
- * console.log(sl.has(4)); // false;
135
+ * @example
136
+ * // Check key existence
137
+ * const sl = new SkipList<number, string>([
138
+ * [1, 'a'],
139
+ * [3, 'c'],
140
+ * [5, 'e']
141
+ * ]);
142
+ * console.log(sl.has(3)); // true;
143
+ * console.log(sl.has(4)); // false;
377
144
  */
378
145
  has(key: K): boolean;
379
146
  /**
380
147
  * Delete a key. Returns `true` if the key was found and removed.
381
-
382
-
383
-
384
-
385
-
386
-
387
-
388
-
389
-
390
-
391
-
392
-
393
-
394
-
395
-
396
-
397
-
398
-
399
-
400
-
401
-
402
-
403
-
404
-
405
-
406
-
407
-
408
-
409
-
410
-
411
-
412
-
413
-
414
-
415
-
416
-
417
-
418
-
419
-
420
-
421
-
422
-
423
- * @example
424
- * // Fast lookup with deletion
425
- * const cache = new SkipList<string, number>();
426
- *
427
- * cache.set('alpha', 1);
428
- * cache.set('beta', 2);
429
- * cache.set('gamma', 3);
430
- *
431
- * console.log(cache.has('beta')); // true;
432
- * cache.delete('beta');
433
- * console.log(cache.has('beta')); // false;
434
- * console.log(cache.size); // 2;
148
+ * @example
149
+ * // Fast lookup with deletion
150
+ * const cache = new SkipList<string, number>();
151
+ *
152
+ * cache.set('alpha', 1);
153
+ * cache.set('beta', 2);
154
+ * cache.set('gamma', 3);
155
+ *
156
+ * console.log(cache.has('beta')); // true;
157
+ * cache.delete('beta');
158
+ * console.log(cache.has('beta')); // false;
159
+ * console.log(cache.size); // 2;
435
160
  */
436
161
  delete(key: K): boolean;
437
162
  /**
438
163
  * Returns the first (smallest key) entry, or `undefined` if empty.
439
-
440
-
441
-
442
-
443
-
444
-
445
-
446
-
447
-
448
-
449
-
450
-
451
-
452
-
453
-
454
-
455
-
456
-
457
-
458
-
459
-
460
-
461
-
462
-
463
-
464
-
465
-
466
-
467
-
468
-
469
-
470
-
471
-
472
-
473
-
474
-
475
-
476
-
477
-
478
-
479
-
480
-
481
- * @example
482
- * // Access the minimum entry
483
- * const sl = new SkipList<number, string>([[5, 'e'], [1, 'a'], [3, 'c']]);
484
- * console.log(sl.first()); // [1, 'a'];
164
+ * @example
165
+ * // Access the minimum entry
166
+ * const sl = new SkipList<number, string>([
167
+ * [5, 'e'],
168
+ * [1, 'a'],
169
+ * [3, 'c']
170
+ * ]);
171
+ * console.log(sl.first()); // [1, 'a'];
485
172
  */
486
173
  first(): [K, V | undefined] | undefined;
487
174
  /**
488
175
  * Returns the last (largest key) entry, or `undefined` if empty.
489
-
490
-
491
-
492
-
493
-
494
-
495
-
496
-
497
-
498
-
499
-
500
-
501
-
502
-
503
-
504
-
505
-
506
-
507
-
508
-
509
-
510
-
511
-
512
-
513
-
514
-
515
-
516
-
517
-
518
-
519
-
520
-
521
-
522
-
523
-
524
-
525
-
526
-
527
-
528
-
529
-
530
-
531
- * @example
532
- * // Access the maximum entry
533
- * const sl = new SkipList<number, string>([[5, 'e'], [1, 'a'], [3, 'c']]);
534
- * console.log(sl.last()); // [5, 'e'];
176
+ * @example
177
+ * // Access the maximum entry
178
+ * const sl = new SkipList<number, string>([
179
+ * [5, 'e'],
180
+ * [1, 'a'],
181
+ * [3, 'c']
182
+ * ]);
183
+ * console.log(sl.last()); // [5, 'e'];
535
184
  */
536
185
  last(): [K, V | undefined] | undefined;
537
186
  /**
538
187
  * Remove and return the first (smallest key) entry.
539
-
540
-
541
-
542
-
543
-
544
-
545
-
546
-
547
-
548
-
549
-
550
-
551
-
552
-
553
-
554
-
555
-
556
-
557
-
558
-
559
-
560
-
561
-
562
-
563
-
564
-
565
-
566
-
567
-
568
-
569
-
570
-
571
-
572
-
573
-
574
-
575
-
576
-
577
-
578
- * @example
579
- * // Remove and return smallest
580
- * const sl = new SkipList<number, string>([[1, 'a'], [2, 'b'], [3, 'c']]);
581
- * console.log(sl.pollFirst()); // [1, 'a'];
582
- * console.log(sl.size); // 2;
188
+ * @example
189
+ * // Remove and return smallest
190
+ * const sl = new SkipList<number, string>([
191
+ * [1, 'a'],
192
+ * [2, 'b'],
193
+ * [3, 'c']
194
+ * ]);
195
+ * console.log(sl.pollFirst()); // [1, 'a'];
196
+ * console.log(sl.size); // 2;
583
197
  */
584
198
  pollFirst(): [K, V | undefined] | undefined;
585
199
  /**
586
200
  * Remove and return the last (largest key) entry.
587
-
588
-
589
-
590
-
591
-
592
-
593
-
594
-
595
-
596
-
597
-
598
-
599
-
600
-
601
-
602
-
603
-
604
-
605
-
606
-
607
-
608
-
609
-
610
-
611
-
612
-
613
-
614
-
615
-
616
-
617
-
618
-
619
-
620
-
621
-
622
-
623
-
624
-
625
-
626
- * @example
627
- * // Remove and return largest
628
- * const sl = new SkipList<number, string>([[1, 'a'], [2, 'b'], [3, 'c']]);
629
- * console.log(sl.pollLast()); // [3, 'c'];
630
- * console.log(sl.size); // 2;
201
+ * @example
202
+ * // Remove and return largest
203
+ * const sl = new SkipList<number, string>([
204
+ * [1, 'a'],
205
+ * [2, 'b'],
206
+ * [3, 'c']
207
+ * ]);
208
+ * console.log(sl.pollLast()); // [3, 'c'];
209
+ * console.log(sl.size); // 2;
631
210
  */
632
211
  pollLast(): [K, V | undefined] | undefined;
633
212
  /**
634
213
  * Least entry ≥ key, or `undefined`.
635
-
636
-
637
-
638
-
639
-
640
-
641
-
642
-
643
-
644
-
645
-
646
-
647
-
648
-
649
-
650
-
651
-
652
-
653
-
654
-
655
-
656
-
657
-
658
-
659
-
660
-
661
-
662
-
663
-
664
-
665
-
666
-
667
-
668
-
669
-
670
-
671
-
672
-
673
-
674
-
675
-
676
-
677
- * @example
678
- * // Least entry ≥ key
679
- * const sl = new SkipList<number, string>([[10, 'a'], [20, 'b'], [30, 'c']]);
680
- * console.log(sl.ceiling(15)); // [20, 'b'];
681
- * console.log(sl.ceiling(20)); // [20, 'b'];
214
+ * @example
215
+ * // Least entry ≥ key
216
+ * const sl = new SkipList<number, string>([
217
+ * [10, 'a'],
218
+ * [20, 'b'],
219
+ * [30, 'c']
220
+ * ]);
221
+ * console.log(sl.ceiling(15)); // [20, 'b'];
222
+ * console.log(sl.ceiling(20)); // [20, 'b'];
682
223
  */
683
224
  ceiling(key: K): [K, V | undefined] | undefined;
684
225
  /**
685
226
  * Greatest entry ≤ key, or `undefined`.
686
-
687
-
688
-
689
-
690
-
691
-
692
-
693
-
694
-
695
-
696
-
697
-
698
-
699
-
700
-
701
-
702
-
703
-
704
-
705
-
706
-
707
-
708
-
709
-
710
-
711
-
712
-
713
-
714
-
715
-
716
-
717
-
718
-
719
-
720
-
721
-
722
-
723
-
724
-
725
-
726
-
727
-
728
- * @example
729
- * // Greatest entry ≤ key
730
- * const sl = new SkipList<number, string>([[10, 'a'], [20, 'b'], [30, 'c']]);
731
- * console.log(sl.floor(25)); // [20, 'b'];
732
- * console.log(sl.floor(5)); // undefined;
227
+ * @example
228
+ * // Greatest entry ≤ key
229
+ * const sl = new SkipList<number, string>([
230
+ * [10, 'a'],
231
+ * [20, 'b'],
232
+ * [30, 'c']
233
+ * ]);
234
+ * console.log(sl.floor(25)); // [20, 'b'];
235
+ * console.log(sl.floor(5)); // undefined;
733
236
  */
734
237
  floor(key: K): [K, V | undefined] | undefined;
735
238
  /**
736
239
  * Least entry strictly > key, or `undefined`.
737
-
738
-
739
-
740
-
741
-
742
-
743
-
744
-
745
-
746
-
747
-
748
-
749
-
750
-
751
-
752
-
753
-
754
-
755
-
756
-
757
-
758
-
759
-
760
-
761
-
762
-
763
-
764
-
765
-
766
-
767
-
768
-
769
-
770
-
771
-
772
-
773
-
774
-
775
-
776
- * @example
777
- * // Strictly greater entry
778
- * const sl = new SkipList<number, string>([[10, 'a'], [20, 'b'], [30, 'c']]);
779
- * console.log(sl.higher(15)); // [20, 'b'];
780
- * console.log(sl.higher(30)); // undefined;
240
+ * @example
241
+ * // Strictly greater entry
242
+ * const sl = new SkipList<number, string>([
243
+ * [10, 'a'],
244
+ * [20, 'b'],
245
+ * [30, 'c']
246
+ * ]);
247
+ * console.log(sl.higher(15)); // [20, 'b'];
248
+ * console.log(sl.higher(30)); // undefined;
781
249
  */
782
250
  higher(key: K): [K, V | undefined] | undefined;
783
251
  /**
784
252
  * Greatest entry strictly < key, or `undefined`.
785
-
786
-
787
-
788
-
789
-
790
-
791
-
792
-
793
-
794
-
795
-
796
-
797
-
798
-
799
-
800
-
801
-
802
-
803
-
804
-
805
-
806
-
807
-
808
-
809
-
810
-
811
-
812
-
813
-
814
-
815
-
816
-
817
-
818
-
819
-
820
-
821
-
822
-
823
-
824
- * @example
825
- * // Strictly less entry
826
- * const sl = new SkipList<number, string>([[10, 'a'], [20, 'b'], [30, 'c']]);
827
- * console.log(sl.lower(25)); // [20, 'b'];
828
- * console.log(sl.lower(10)); // undefined;
253
+ * @example
254
+ * // Strictly less entry
255
+ * const sl = new SkipList<number, string>([
256
+ * [10, 'a'],
257
+ * [20, 'b'],
258
+ * [30, 'c']
259
+ * ]);
260
+ * console.log(sl.lower(25)); // [20, 'b'];
261
+ * console.log(sl.lower(10)); // undefined;
829
262
  */
830
263
  lower(key: K): [K, V | undefined] | undefined;
831
264
  /**
832
265
  * Returns entries within the given key range.
833
-
834
-
835
-
836
-
837
-
838
-
839
-
840
-
841
-
842
-
843
-
844
-
845
-
846
-
847
-
848
-
849
-
850
-
851
-
852
-
853
-
854
-
855
-
856
-
857
-
858
-
859
-
860
-
861
-
862
-
863
-
864
-
865
-
866
-
867
-
868
-
869
-
870
-
871
-
872
-
873
-
874
-
875
- * @example
876
- * // Find entries in a range
877
- * const sl = new SkipList<number, string>([[1, 'a'], [2, 'b'], [3, 'c'], [4, 'd'], [5, 'e']]);
878
- * const result = sl.rangeSearch([2, 4]);
879
- * console.log(result); // [[2, 'b'], [3, 'c'], [4, 'd']];
266
+ * @example
267
+ * // Find entries in a range
268
+ * const sl = new SkipList<number, string>([
269
+ * [1, 'a'],
270
+ * [2, 'b'],
271
+ * [3, 'c'],
272
+ * [4, 'd'],
273
+ * [5, 'e']
274
+ * ]);
275
+ * const result = sl.rangeSearch([2, 4]);
276
+ * console.log(result); // [
277
+ * // [2, 'b'],
278
+ * // [3, 'c'],
279
+ * // [4, 'd']
280
+ * // ];
880
281
  */
881
282
  rangeSearch(range: [K, K], options?: SkipListRangeOptions): Array<[K, V | undefined]>;
882
283
  /**
883
284
  * Creates a new SkipList with entries transformed by callback.
884
-
885
-
886
-
887
-
888
-
889
-
890
-
891
-
892
-
893
-
894
-
895
-
896
-
897
-
898
-
899
-
900
-
901
-
902
-
903
-
904
-
905
-
906
-
907
-
908
-
909
-
910
-
911
-
912
-
913
-
914
-
915
-
916
-
917
-
918
-
919
-
920
-
921
-
922
-
923
- * @example
924
- * // Transform entries
925
- * const sl = new SkipList<number, string>([[1, 'a'], [2, 'b']]);
926
- * const mapped = sl.map((v, k) => [k, v?.toUpperCase()] as [number, string]);
927
- * console.log([...mapped.values()]); // ['A', 'B'];
285
+ * @example
286
+ * // Transform entries
287
+ * const sl = new SkipList<number, string>([
288
+ * [1, 'a'],
289
+ * [2, 'b']
290
+ * ]);
291
+ * const mapped = sl.map((v, k) => [k, v?.toUpperCase()] as [number, string]);
292
+ * console.log([...mapped.values()]); // ['A', 'B'];
928
293
  */
929
294
  map<MK, MV>(callback: EntryCallback<K, V | undefined, [MK, MV]>, options?: SkipListOptions<MK, MV>): SkipList<MK, MV>;
930
295
  /**
931
296
  * Creates a new SkipList with entries that pass the predicate.
932
-
933
-
934
-
935
-
936
-
937
-
938
-
939
-
940
-
941
-
942
-
943
-
944
-
945
-
946
-
947
-
948
-
949
-
950
-
951
-
952
-
953
-
954
-
955
-
956
-
957
-
958
-
959
-
960
-
961
-
962
-
963
-
964
-
965
-
966
-
967
-
968
-
969
-
970
-
971
- * @example
972
- * // Filter entries
973
- * const sl = new SkipList<number, string>([[1, 'a'], [2, 'b'], [3, 'c']]);
974
- * const result = sl.filter((v, k) => k > 1);
975
- * console.log(result.size); // 2;
297
+ * @example
298
+ * // Filter entries
299
+ * const sl = new SkipList<number, string>([
300
+ * [1, 'a'],
301
+ * [2, 'b'],
302
+ * [3, 'c']
303
+ * ]);
304
+ * const result = sl.filter((v, k) => k > 1);
305
+ * console.log(result.size); // 2;
976
306
  */
977
307
  filter(callbackfn: EntryCallback<K, V | undefined, boolean>, thisArg?: unknown): this;
978
308
  protected _getIterator(): IterableIterator<[K, V | undefined]>;