data-structure-typed 2.5.2 → 2.6.0
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.
- package/.husky/pre-commit +3 -0
- package/CHANGELOG.md +3 -1
- package/MIGRATION.md +217 -0
- package/README.md +80 -8
- package/README_CN.md +569 -143
- package/SPECIFICATION.md +44 -14
- package/SPECIFICATION.zh-CN.md +44 -14
- package/dist/cjs/binary-tree.cjs +5841 -1678
- package/dist/cjs/graph.cjs +422 -14
- package/dist/cjs/hash.cjs +95 -7
- package/dist/cjs/heap.cjs +174 -16
- package/dist/cjs/index.cjs +7751 -2449
- package/dist/cjs/linked-list.cjs +443 -2
- package/dist/cjs/matrix.cjs +56 -0
- package/dist/cjs/priority-queue.cjs +172 -14
- package/dist/cjs/queue.cjs +435 -0
- package/dist/cjs/stack.cjs +103 -4
- package/dist/cjs/trie.cjs +106 -0
- package/dist/cjs-legacy/binary-tree.cjs +5933 -1772
- package/dist/cjs-legacy/graph.cjs +422 -14
- package/dist/cjs-legacy/hash.cjs +95 -7
- package/dist/cjs-legacy/heap.cjs +174 -16
- package/dist/cjs-legacy/index.cjs +8154 -2854
- package/dist/cjs-legacy/linked-list.cjs +443 -2
- package/dist/cjs-legacy/matrix.cjs +56 -0
- package/dist/cjs-legacy/priority-queue.cjs +172 -14
- package/dist/cjs-legacy/queue.cjs +435 -0
- package/dist/cjs-legacy/stack.cjs +103 -4
- package/dist/cjs-legacy/trie.cjs +106 -0
- package/dist/esm/binary-tree.mjs +5841 -1678
- package/dist/esm/graph.mjs +422 -14
- package/dist/esm/hash.mjs +95 -7
- package/dist/esm/heap.mjs +174 -16
- package/dist/esm/index.mjs +7751 -2449
- package/dist/esm/linked-list.mjs +443 -2
- package/dist/esm/matrix.mjs +56 -0
- package/dist/esm/priority-queue.mjs +172 -14
- package/dist/esm/queue.mjs +435 -0
- package/dist/esm/stack.mjs +103 -4
- package/dist/esm/trie.mjs +106 -0
- package/dist/esm-legacy/binary-tree.mjs +5933 -1772
- package/dist/esm-legacy/graph.mjs +422 -14
- package/dist/esm-legacy/hash.mjs +95 -7
- package/dist/esm-legacy/heap.mjs +174 -16
- package/dist/esm-legacy/index.mjs +8154 -2854
- package/dist/esm-legacy/linked-list.mjs +443 -2
- package/dist/esm-legacy/matrix.mjs +56 -0
- package/dist/esm-legacy/priority-queue.mjs +172 -14
- package/dist/esm-legacy/queue.mjs +435 -0
- package/dist/esm-legacy/stack.mjs +103 -4
- package/dist/esm-legacy/trie.mjs +106 -0
- package/dist/types/data-structures/base/iterable-element-base.d.ts +17 -0
- package/dist/types/data-structures/base/linear-base.d.ts +6 -0
- package/dist/types/data-structures/binary-tree/avl-tree.d.ts +86 -2
- package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +98 -0
- package/dist/types/data-structures/binary-tree/binary-tree.d.ts +191 -15
- package/dist/types/data-structures/binary-tree/bst.d.ts +171 -3
- package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +136 -8
- package/dist/types/data-structures/binary-tree/segment-tree.d.ts +42 -0
- package/dist/types/data-structures/binary-tree/tree-map.d.ts +1061 -167
- package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +1232 -355
- package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +916 -194
- package/dist/types/data-structures/binary-tree/tree-set.d.ts +1078 -141
- package/dist/types/data-structures/graph/directed-graph.d.ts +70 -0
- package/dist/types/data-structures/graph/undirected-graph.d.ts +63 -0
- package/dist/types/data-structures/hash/hash-map.d.ts +84 -6
- package/dist/types/data-structures/heap/heap.d.ts +140 -12
- package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +150 -2
- package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +106 -1
- package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +126 -0
- package/dist/types/data-structures/matrix/matrix.d.ts +56 -0
- package/dist/types/data-structures/queue/deque.d.ts +171 -0
- package/dist/types/data-structures/queue/queue.d.ts +97 -0
- package/dist/types/data-structures/stack/stack.d.ts +72 -2
- package/dist/types/data-structures/trie/trie.d.ts +84 -0
- package/dist/types/interfaces/binary-tree.d.ts +2 -3
- package/dist/umd/data-structure-typed.js +7784 -2484
- package/dist/umd/data-structure-typed.min.js +4 -4
- package/docs-site-docusaurus/docs/api/classes/AVLTree.md +188 -200
- package/docs-site-docusaurus/docs/api/classes/AVLTreeNode.md +11 -11
- package/docs-site-docusaurus/docs/api/classes/AbstractGraph.md +62 -62
- package/docs-site-docusaurus/docs/api/classes/BST.md +183 -195
- package/docs-site-docusaurus/docs/api/classes/BSTNode.md +13 -13
- package/docs-site-docusaurus/docs/api/classes/BinaryIndexedTree.md +15 -15
- package/docs-site-docusaurus/docs/api/classes/BinaryTree.md +143 -155
- package/docs-site-docusaurus/docs/api/classes/BinaryTreeNode.md +13 -13
- package/docs-site-docusaurus/docs/api/classes/Deque.md +99 -85
- package/docs-site-docusaurus/docs/api/classes/DirectedGraph.md +73 -73
- package/docs-site-docusaurus/docs/api/classes/DoublyLinkedList.md +100 -70
- package/docs-site-docusaurus/docs/api/classes/DoublyLinkedListNode.md +8 -8
- package/docs-site-docusaurus/docs/api/classes/FibonacciHeap.md +12 -12
- package/docs-site-docusaurus/docs/api/classes/FibonacciHeapNode.md +1 -1
- package/docs-site-docusaurus/docs/api/classes/HashMap.md +38 -38
- package/docs-site-docusaurus/docs/api/classes/Heap.md +96 -85
- package/docs-site-docusaurus/docs/api/classes/IterableElementBase.md +25 -25
- package/docs-site-docusaurus/docs/api/classes/IterableEntryBase.md +23 -23
- package/docs-site-docusaurus/docs/api/classes/LinearBase.md +48 -48
- package/docs-site-docusaurus/docs/api/classes/LinearLinkedBase.md +52 -52
- package/docs-site-docusaurus/docs/api/classes/LinkedHashMap.md +46 -42
- package/docs-site-docusaurus/docs/api/classes/LinkedListNode.md +6 -6
- package/docs-site-docusaurus/docs/api/classes/LinkedListQueue.md +74 -74
- package/docs-site-docusaurus/docs/api/classes/MapGraph.md +73 -73
- package/docs-site-docusaurus/docs/api/classes/Matrix.md +31 -31
- package/docs-site-docusaurus/docs/api/classes/MaxHeap.md +104 -89
- package/docs-site-docusaurus/docs/api/classes/MaxPriorityQueue.md +104 -89
- package/docs-site-docusaurus/docs/api/classes/MinHeap.md +104 -89
- package/docs-site-docusaurus/docs/api/classes/MinPriorityQueue.md +104 -89
- package/docs-site-docusaurus/docs/api/classes/Navigator.md +5 -5
- package/docs-site-docusaurus/docs/api/classes/PriorityQueue.md +103 -88
- package/docs-site-docusaurus/docs/api/classes/Queue.md +111 -59
- package/docs-site-docusaurus/docs/api/classes/RedBlackTree.md +200 -212
- package/docs-site-docusaurus/docs/api/classes/SegmentTree.md +10 -10
- package/docs-site-docusaurus/docs/api/classes/SinglyLinkedList.md +75 -75
- package/docs-site-docusaurus/docs/api/classes/SinglyLinkedListNode.md +6 -6
- package/docs-site-docusaurus/docs/api/classes/SkipList.md +37 -37
- package/docs-site-docusaurus/docs/api/classes/Stack.md +42 -42
- package/docs-site-docusaurus/docs/api/classes/TreeMap.md +107 -36
- package/docs-site-docusaurus/docs/api/classes/TreeMultiMap.md +43 -43
- package/docs-site-docusaurus/docs/api/classes/TreeSet.md +106 -35
- package/docs-site-docusaurus/docs/api/classes/Trie.md +43 -43
- package/docs-site-docusaurus/docs/api/classes/TrieNode.md +8 -8
- package/docs-site-docusaurus/docs/api/classes/UndirectedGraph.md +72 -72
- package/docs-site-docusaurus/docs/guide/architecture.md +75 -7
- package/docs-site-docusaurus/docs/guide/concepts.md +53 -34
- package/docs-site-docusaurus/docs/guide/faq.md +53 -0
- package/docs-site-docusaurus/docs/guide/guides.md +8 -9
- package/docs-site-docusaurus/docs/guide/integrations.md +74 -177
- package/docs-site-docusaurus/docs/guide/overview.md +131 -17
- package/docs-site-docusaurus/src/pages/index.tsx +4 -0
- package/docs-site-docusaurus/typedoc.json +1 -0
- package/jest.integration.config.js +1 -2
- package/package.json +10 -7
- package/src/data-structures/base/iterable-element-base.ts +32 -0
- package/src/data-structures/base/linear-base.ts +11 -0
- package/src/data-structures/binary-tree/avl-tree.ts +88 -5
- package/src/data-structures/binary-tree/binary-indexed-tree.ts +98 -0
- package/src/data-structures/binary-tree/binary-tree.ts +242 -81
- package/src/data-structures/binary-tree/bst.ts +173 -7
- package/src/data-structures/binary-tree/red-black-tree.ts +139 -15
- package/src/data-structures/binary-tree/segment-tree.ts +42 -0
- package/src/data-structures/binary-tree/tree-map.ts +948 -36
- package/src/data-structures/binary-tree/tree-multi-map.ts +893 -13
- package/src/data-structures/binary-tree/tree-multi-set.ts +761 -33
- package/src/data-structures/binary-tree/tree-set.ts +1260 -251
- package/src/data-structures/graph/directed-graph.ts +71 -1
- package/src/data-structures/graph/undirected-graph.ts +64 -1
- package/src/data-structures/hash/hash-map.ts +100 -12
- package/src/data-structures/heap/heap.ts +149 -19
- package/src/data-structures/linked-list/doubly-linked-list.ts +178 -2
- package/src/data-structures/linked-list/singly-linked-list.ts +106 -1
- package/src/data-structures/linked-list/skip-linked-list.ts +126 -0
- package/src/data-structures/matrix/matrix.ts +56 -0
- package/src/data-structures/queue/deque.ts +187 -0
- package/src/data-structures/queue/queue.ts +109 -0
- package/src/data-structures/stack/stack.ts +75 -5
- package/src/data-structures/trie/trie.ts +84 -0
- package/src/interfaces/binary-tree.ts +1 -9
- package/.vitepress/cache/deps_temp_51f5f1b0/chunk-7OIKW5WK.js +0 -12984
- package/.vitepress/cache/deps_temp_51f5f1b0/package.json +0 -3
- package/.vitepress/cache/deps_temp_51f5f1b0/vitepress___@vue_devtools-api.js +0 -4505
- package/.vitepress/cache/deps_temp_51f5f1b0/vitepress___@vueuse_core.js +0 -9731
- package/.vitepress/cache/deps_temp_51f5f1b0/vue.js +0 -347
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
# Class: SinglyLinkedListNode\<E\>
|
|
8
8
|
|
|
9
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:17](https://github.com/zrwusa/data-structure-typed/blob/
|
|
9
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:17](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L17)
|
|
10
10
|
|
|
11
11
|
Node of a singly linked list; stores value and the next link.
|
|
12
12
|
|
|
@@ -32,7 +32,7 @@ Time O(1), Space O(1)
|
|
|
32
32
|
new SinglyLinkedListNode<E>(value): SinglyLinkedListNode<E>;
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:25](https://github.com/zrwusa/data-structure-typed/blob/
|
|
35
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:25](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L25)
|
|
36
36
|
|
|
37
37
|
Create a list node.
|
|
38
38
|
|
|
@@ -68,7 +68,7 @@ Time O(1), Space O(1)
|
|
|
68
68
|
get next(): SinglyLinkedListNode<E> | undefined;
|
|
69
69
|
```
|
|
70
70
|
|
|
71
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:39](https://github.com/zrwusa/data-structure-typed/blob/
|
|
71
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:39](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L39)
|
|
72
72
|
|
|
73
73
|
Get the next node.
|
|
74
74
|
|
|
@@ -88,7 +88,7 @@ Next node or undefined.
|
|
|
88
88
|
set next(value): void;
|
|
89
89
|
```
|
|
90
90
|
|
|
91
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:50](https://github.com/zrwusa/data-structure-typed/blob/
|
|
91
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:50](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L50)
|
|
92
92
|
|
|
93
93
|
Set the next node.
|
|
94
94
|
|
|
@@ -124,7 +124,7 @@ void
|
|
|
124
124
|
get value(): E;
|
|
125
125
|
```
|
|
126
126
|
|
|
127
|
-
Defined in: [data-structures/base/linear-base.ts:27](https://github.com/zrwusa/data-structure-typed/blob/
|
|
127
|
+
Defined in: [data-structures/base/linear-base.ts:27](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L27)
|
|
128
128
|
|
|
129
129
|
Element payload getter.
|
|
130
130
|
|
|
@@ -144,7 +144,7 @@ Element value.
|
|
|
144
144
|
set value(value): void;
|
|
145
145
|
```
|
|
146
146
|
|
|
147
|
-
Defined in: [data-structures/base/linear-base.ts:36](https://github.com/zrwusa/data-structure-typed/blob/
|
|
147
|
+
Defined in: [data-structures/base/linear-base.ts:36](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L36)
|
|
148
148
|
|
|
149
149
|
Element payload setter.
|
|
150
150
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
# Class: SkipList\<K, V, R\>
|
|
8
8
|
|
|
9
|
-
Defined in: [data-structures/linked-list/skip-linked-list.ts:49](https://github.com/zrwusa/data-structure-typed/blob/
|
|
9
|
+
Defined in: [data-structures/linked-list/skip-linked-list.ts:49](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/skip-linked-list.ts#L49)
|
|
10
10
|
|
|
11
11
|
SkipList — a probabilistic sorted key-value container.
|
|
12
12
|
|
|
@@ -49,7 +49,7 @@ Reference: Java ConcurrentSkipListMap (NavigableMap interface).
|
|
|
49
49
|
get size(): number;
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
-
Defined in: [data-structures/linked-list/skip-linked-list.ts:122](https://github.com/zrwusa/data-structure-typed/blob/
|
|
52
|
+
Defined in: [data-structures/linked-list/skip-linked-list.ts:122](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/skip-linked-list.ts#L122)
|
|
53
53
|
|
|
54
54
|
Total number of entries.
|
|
55
55
|
|
|
@@ -75,7 +75,7 @@ Entry count.
|
|
|
75
75
|
iterator: IterableIterator<[K, V | undefined]>;
|
|
76
76
|
```
|
|
77
77
|
|
|
78
|
-
Defined in: [data-structures/base/iterable-entry-base.ts:22](https://github.com/zrwusa/data-structure-typed/blob/
|
|
78
|
+
Defined in: [data-structures/base/iterable-entry-base.ts:22](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-entry-base.ts#L22)
|
|
79
79
|
|
|
80
80
|
Default iterator yielding `[key, value]` entries.
|
|
81
81
|
|
|
@@ -107,7 +107,7 @@ Time O(n) to iterate, Space O(1)
|
|
|
107
107
|
ceiling(key): [K, V | undefined] | undefined;
|
|
108
108
|
```
|
|
109
109
|
|
|
110
|
-
Defined in: [data-structures/linked-list/skip-linked-list.ts:
|
|
110
|
+
Defined in: [data-structures/linked-list/skip-linked-list.ts:831](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/skip-linked-list.ts#L831)
|
|
111
111
|
|
|
112
112
|
Least entry ≥ key, or `undefined`.
|
|
113
113
|
|
|
@@ -140,7 +140,7 @@ Least entry ≥ key, or `undefined`.
|
|
|
140
140
|
clear(): void;
|
|
141
141
|
```
|
|
142
142
|
|
|
143
|
-
Defined in: [data-structures/linked-list/skip-linked-list.ts:
|
|
143
|
+
Defined in: [data-structures/linked-list/skip-linked-list.ts:229](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/skip-linked-list.ts#L229)
|
|
144
144
|
|
|
145
145
|
Remove all entries
|
|
146
146
|
|
|
@@ -171,7 +171,7 @@ Remove all entries
|
|
|
171
171
|
clone(): this;
|
|
172
172
|
```
|
|
173
173
|
|
|
174
|
-
Defined in: [data-structures/linked-list/skip-linked-list.ts:
|
|
174
|
+
Defined in: [data-structures/linked-list/skip-linked-list.ts:280](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/skip-linked-list.ts#L280)
|
|
175
175
|
|
|
176
176
|
Create independent copy
|
|
177
177
|
|
|
@@ -203,7 +203,7 @@ Create independent copy
|
|
|
203
203
|
delete(key): boolean;
|
|
204
204
|
```
|
|
205
205
|
|
|
206
|
-
Defined in: [data-structures/linked-list/skip-linked-list.ts:
|
|
206
|
+
Defined in: [data-structures/linked-list/skip-linked-list.ts:553](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/skip-linked-list.ts#L553)
|
|
207
207
|
|
|
208
208
|
Delete a key. Returns `true` if the key was found and removed.
|
|
209
209
|
|
|
@@ -243,7 +243,7 @@ Delete a key. Returns `true` if the key was found and removed.
|
|
|
243
243
|
entries(): IterableIterator<[K, V | undefined]>;
|
|
244
244
|
```
|
|
245
245
|
|
|
246
|
-
Defined in: [data-structures/base/iterable-entry-base.ts:31](https://github.com/zrwusa/data-structure-typed/blob/
|
|
246
|
+
Defined in: [data-structures/base/iterable-entry-base.ts:31](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-entry-base.ts#L31)
|
|
247
247
|
|
|
248
248
|
Iterate over `[key, value]` pairs (may yield `undefined` values).
|
|
249
249
|
|
|
@@ -269,7 +269,7 @@ Time O(n), Space O(1)
|
|
|
269
269
|
every(predicate, thisArg?): boolean;
|
|
270
270
|
```
|
|
271
271
|
|
|
272
|
-
Defined in: [data-structures/base/iterable-entry-base.ts:66](https://github.com/zrwusa/data-structure-typed/blob/
|
|
272
|
+
Defined in: [data-structures/base/iterable-entry-base.ts:66](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-entry-base.ts#L66)
|
|
273
273
|
|
|
274
274
|
Test whether all entries satisfy the predicate.
|
|
275
275
|
|
|
@@ -309,7 +309,7 @@ Time O(n), Space O(1)
|
|
|
309
309
|
filter(callbackfn, thisArg?): this;
|
|
310
310
|
```
|
|
311
311
|
|
|
312
|
-
Defined in: [data-structures/linked-list/skip-linked-list.ts:
|
|
312
|
+
Defined in: [data-structures/linked-list/skip-linked-list.ts:1201](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/skip-linked-list.ts#L1201)
|
|
313
313
|
|
|
314
314
|
Creates a new SkipList with entries that pass the predicate.
|
|
315
315
|
|
|
@@ -350,7 +350,7 @@ Creates a new SkipList with entries that pass the predicate.
|
|
|
350
350
|
find(callbackfn, thisArg?): [K, V | undefined] | undefined;
|
|
351
351
|
```
|
|
352
352
|
|
|
353
|
-
Defined in: [data-structures/base/iterable-entry-base.ts:114](https://github.com/zrwusa/data-structure-typed/blob/
|
|
353
|
+
Defined in: [data-structures/base/iterable-entry-base.ts:114](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-entry-base.ts#L114)
|
|
354
354
|
|
|
355
355
|
Find the first entry that matches a predicate.
|
|
356
356
|
|
|
@@ -390,7 +390,7 @@ Time O(n), Space O(1)
|
|
|
390
390
|
first(): [K, V | undefined] | undefined;
|
|
391
391
|
```
|
|
392
392
|
|
|
393
|
-
Defined in: [data-structures/linked-list/skip-linked-list.ts:
|
|
393
|
+
Defined in: [data-structures/linked-list/skip-linked-list.ts:621](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/skip-linked-list.ts#L621)
|
|
394
394
|
|
|
395
395
|
Returns the first (smallest key) entry, or `undefined` if empty.
|
|
396
396
|
|
|
@@ -416,7 +416,7 @@ Returns the first (smallest key) entry, or `undefined` if empty.
|
|
|
416
416
|
floor(key): [K, V | undefined] | undefined;
|
|
417
417
|
```
|
|
418
418
|
|
|
419
|
-
Defined in: [data-structures/linked-list/skip-linked-list.ts:
|
|
419
|
+
Defined in: [data-structures/linked-list/skip-linked-list.ts:890](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/skip-linked-list.ts#L890)
|
|
420
420
|
|
|
421
421
|
Greatest entry ≤ key, or `undefined`.
|
|
422
422
|
|
|
@@ -449,7 +449,7 @@ Greatest entry ≤ key, or `undefined`.
|
|
|
449
449
|
forEach(callbackfn, thisArg?): void;
|
|
450
450
|
```
|
|
451
451
|
|
|
452
|
-
Defined in: [data-structures/base/iterable-entry-base.ts:99](https://github.com/zrwusa/data-structure-typed/blob/
|
|
452
|
+
Defined in: [data-structures/base/iterable-entry-base.ts:99](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-entry-base.ts#L99)
|
|
453
453
|
|
|
454
454
|
Visit each entry, left-to-right.
|
|
455
455
|
|
|
@@ -487,7 +487,7 @@ Time O(n), Space O(1)
|
|
|
487
487
|
get(key): V | undefined;
|
|
488
488
|
```
|
|
489
489
|
|
|
490
|
-
Defined in: [data-structures/linked-list/skip-linked-list.ts:
|
|
490
|
+
Defined in: [data-structures/linked-list/skip-linked-list.ts:442](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/skip-linked-list.ts#L442)
|
|
491
491
|
|
|
492
492
|
Get the value for a key, or `undefined` if not found.
|
|
493
493
|
Overrides base O(n) with O(log n) skip-list search.
|
|
@@ -540,7 +540,7 @@ Overrides base O(n) with O(log n) skip-list search.
|
|
|
540
540
|
has(key): boolean;
|
|
541
541
|
```
|
|
542
542
|
|
|
543
|
-
Defined in: [data-structures/linked-list/skip-linked-list.ts:
|
|
543
|
+
Defined in: [data-structures/linked-list/skip-linked-list.ts:495](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/skip-linked-list.ts#L495)
|
|
544
544
|
|
|
545
545
|
Check if a key exists.
|
|
546
546
|
Overrides base O(n) with O(log n) skip-list search.
|
|
@@ -578,7 +578,7 @@ Overrides base O(n) with O(log n) skip-list search.
|
|
|
578
578
|
hasValue(value): boolean;
|
|
579
579
|
```
|
|
580
580
|
|
|
581
|
-
Defined in: [data-structures/base/iterable-entry-base.ts:143](https://github.com/zrwusa/data-structure-typed/blob/
|
|
581
|
+
Defined in: [data-structures/base/iterable-entry-base.ts:143](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-entry-base.ts#L143)
|
|
582
582
|
|
|
583
583
|
Whether there exists an entry with the given value.
|
|
584
584
|
|
|
@@ -612,7 +612,7 @@ Time O(n), Space O(1)
|
|
|
612
612
|
higher(key): [K, V | undefined] | undefined;
|
|
613
613
|
```
|
|
614
614
|
|
|
615
|
-
Defined in: [data-structures/linked-list/skip-linked-list.ts:
|
|
615
|
+
Defined in: [data-structures/linked-list/skip-linked-list.ts:949](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/skip-linked-list.ts#L949)
|
|
616
616
|
|
|
617
617
|
Least entry strictly > key, or `undefined`.
|
|
618
618
|
|
|
@@ -645,7 +645,7 @@ Least entry strictly > key, or `undefined`.
|
|
|
645
645
|
isEmpty(): boolean;
|
|
646
646
|
```
|
|
647
647
|
|
|
648
|
-
Defined in: [data-structures/linked-list/skip-linked-list.ts:
|
|
648
|
+
Defined in: [data-structures/linked-list/skip-linked-list.ts:181](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/skip-linked-list.ts#L181)
|
|
649
649
|
|
|
650
650
|
Check if empty
|
|
651
651
|
|
|
@@ -675,7 +675,7 @@ Check if empty
|
|
|
675
675
|
keys(): IterableIterator<K>;
|
|
676
676
|
```
|
|
677
677
|
|
|
678
|
-
Defined in: [data-structures/base/iterable-entry-base.ts:42](https://github.com/zrwusa/data-structure-typed/blob/
|
|
678
|
+
Defined in: [data-structures/base/iterable-entry-base.ts:42](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-entry-base.ts#L42)
|
|
679
679
|
|
|
680
680
|
Iterate over keys only.
|
|
681
681
|
|
|
@@ -701,7 +701,7 @@ Time O(n), Space O(1)
|
|
|
701
701
|
last(): [K, V | undefined] | undefined;
|
|
702
702
|
```
|
|
703
703
|
|
|
704
|
-
Defined in: [data-structures/linked-list/skip-linked-list.ts:
|
|
704
|
+
Defined in: [data-structures/linked-list/skip-linked-list.ts:672](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/skip-linked-list.ts#L672)
|
|
705
705
|
|
|
706
706
|
Returns the last (largest key) entry, or `undefined` if empty.
|
|
707
707
|
|
|
@@ -727,7 +727,7 @@ Returns the last (largest key) entry, or `undefined` if empty.
|
|
|
727
727
|
lower(key): [K, V | undefined] | undefined;
|
|
728
728
|
```
|
|
729
729
|
|
|
730
|
-
Defined in: [data-structures/linked-list/skip-linked-list.ts:
|
|
730
|
+
Defined in: [data-structures/linked-list/skip-linked-list.ts:1005](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/skip-linked-list.ts#L1005)
|
|
731
731
|
|
|
732
732
|
Greatest entry strictly < key, or `undefined`.
|
|
733
733
|
|
|
@@ -760,7 +760,7 @@ Greatest entry strictly < key, or `undefined`.
|
|
|
760
760
|
map<MK, MV>(callback, options?): SkipList<MK, MV>;
|
|
761
761
|
```
|
|
762
762
|
|
|
763
|
-
Defined in: [data-structures/linked-list/skip-linked-list.ts:
|
|
763
|
+
Defined in: [data-structures/linked-list/skip-linked-list.ts:1144](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/skip-linked-list.ts#L1144)
|
|
764
764
|
|
|
765
765
|
Creates a new SkipList with entries transformed by callback.
|
|
766
766
|
|
|
@@ -811,7 +811,7 @@ Creates a new SkipList with entries transformed by callback.
|
|
|
811
811
|
pollFirst(): [K, V | undefined] | undefined;
|
|
812
812
|
```
|
|
813
813
|
|
|
814
|
-
Defined in: [data-structures/linked-list/skip-linked-list.ts:
|
|
814
|
+
Defined in: [data-structures/linked-list/skip-linked-list.ts:726](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/skip-linked-list.ts#L726)
|
|
815
815
|
|
|
816
816
|
Remove and return the first (smallest key) entry.
|
|
817
817
|
|
|
@@ -838,7 +838,7 @@ Remove and return the first (smallest key) entry.
|
|
|
838
838
|
pollLast(): [K, V | undefined] | undefined;
|
|
839
839
|
```
|
|
840
840
|
|
|
841
|
-
Defined in: [data-structures/linked-list/skip-linked-list.ts:
|
|
841
|
+
Defined in: [data-structures/linked-list/skip-linked-list.ts:777](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/skip-linked-list.ts#L777)
|
|
842
842
|
|
|
843
843
|
Remove and return the last (largest key) entry.
|
|
844
844
|
|
|
@@ -865,7 +865,7 @@ Remove and return the last (largest key) entry.
|
|
|
865
865
|
print(): void;
|
|
866
866
|
```
|
|
867
867
|
|
|
868
|
-
Defined in: [data-structures/base/iterable-entry-base.ts:203](https://github.com/zrwusa/data-structure-typed/blob/
|
|
868
|
+
Defined in: [data-structures/base/iterable-entry-base.ts:203](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-entry-base.ts#L203)
|
|
869
869
|
|
|
870
870
|
Print a human-friendly representation to the console.
|
|
871
871
|
|
|
@@ -889,7 +889,7 @@ Time O(n), Space O(n)
|
|
|
889
889
|
rangeSearch(range, options?): [K, V | undefined][];
|
|
890
890
|
```
|
|
891
891
|
|
|
892
|
-
Defined in: [data-structures/linked-list/skip-linked-list.ts:
|
|
892
|
+
Defined in: [data-structures/linked-list/skip-linked-list.ts:1067](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/skip-linked-list.ts#L1067)
|
|
893
893
|
|
|
894
894
|
Returns entries within the given key range.
|
|
895
895
|
|
|
@@ -926,7 +926,7 @@ Returns entries within the given key range.
|
|
|
926
926
|
reduce<U>(callbackfn, initialValue): U;
|
|
927
927
|
```
|
|
928
928
|
|
|
929
|
-
Defined in: [data-structures/base/iterable-entry-base.ts:171](https://github.com/zrwusa/data-structure-typed/blob/
|
|
929
|
+
Defined in: [data-structures/base/iterable-entry-base.ts:171](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-entry-base.ts#L171)
|
|
930
930
|
|
|
931
931
|
Reduce entries into a single accumulator.
|
|
932
932
|
|
|
@@ -972,7 +972,7 @@ Time O(n), Space O(1)
|
|
|
972
972
|
set(key, value): this;
|
|
973
973
|
```
|
|
974
974
|
|
|
975
|
-
Defined in: [data-structures/linked-list/skip-linked-list.ts:
|
|
975
|
+
Defined in: [data-structures/linked-list/skip-linked-list.ts:349](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/skip-linked-list.ts#L349)
|
|
976
976
|
|
|
977
977
|
Insert or update a key-value pair. Returns `this` for chaining.
|
|
978
978
|
Unique keys only — if key exists, value is updated in place.
|
|
@@ -1021,7 +1021,7 @@ Unique keys only — if key exists, value is updated in place.
|
|
|
1021
1021
|
some(predicate, thisArg?): boolean;
|
|
1022
1022
|
```
|
|
1023
1023
|
|
|
1024
|
-
Defined in: [data-structures/base/iterable-entry-base.ts:83](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1024
|
+
Defined in: [data-structures/base/iterable-entry-base.ts:83](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-entry-base.ts#L83)
|
|
1025
1025
|
|
|
1026
1026
|
Test whether any entry satisfies the predicate.
|
|
1027
1027
|
|
|
@@ -1061,7 +1061,7 @@ Time O(n), Space O(1)
|
|
|
1061
1061
|
toArray(): [K, V | undefined][];
|
|
1062
1062
|
```
|
|
1063
1063
|
|
|
1064
|
-
Defined in: [data-structures/base/iterable-entry-base.ts:186](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1064
|
+
Defined in: [data-structures/base/iterable-entry-base.ts:186](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-entry-base.ts#L186)
|
|
1065
1065
|
|
|
1066
1066
|
Converts data structure to `[key, value]` pairs.
|
|
1067
1067
|
|
|
@@ -1087,7 +1087,7 @@ Time O(n), Space O(n)
|
|
|
1087
1087
|
toVisual(): string | [K, V | undefined][];
|
|
1088
1088
|
```
|
|
1089
1089
|
|
|
1090
|
-
Defined in: [data-structures/base/iterable-entry-base.ts:195](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1090
|
+
Defined in: [data-structures/base/iterable-entry-base.ts:195](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-entry-base.ts#L195)
|
|
1091
1091
|
|
|
1092
1092
|
Visualize the iterable as an array of `[key, value]` pairs (or a custom string).
|
|
1093
1093
|
|
|
@@ -1113,7 +1113,7 @@ Time O(n), Space O(n)
|
|
|
1113
1113
|
values(): IterableIterator<V | undefined>;
|
|
1114
1114
|
```
|
|
1115
1115
|
|
|
1116
|
-
Defined in: [data-structures/base/iterable-entry-base.ts:53](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1116
|
+
Defined in: [data-structures/base/iterable-entry-base.ts:53](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-entry-base.ts#L53)
|
|
1117
1117
|
|
|
1118
1118
|
Iterate over values only.
|
|
1119
1119
|
|
|
@@ -1139,7 +1139,7 @@ Time O(n), Space O(1)
|
|
|
1139
1139
|
static createDefaultComparator<K>(): Comparator<K>;
|
|
1140
1140
|
```
|
|
1141
1141
|
|
|
1142
|
-
Defined in: [data-structures/linked-list/skip-linked-list.ts:86](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1142
|
+
Defined in: [data-structures/linked-list/skip-linked-list.ts:86](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/skip-linked-list.ts#L86)
|
|
1143
1143
|
|
|
1144
1144
|
Creates a default comparator supporting number, string, Date, and bigint.
|
|
1145
1145
|
|
|
@@ -1164,7 +1164,7 @@ Creates a default comparator supporting number, string, Date, and bigint.
|
|
|
1164
1164
|
protected _findNode(key): SkipListNode<K, V> | undefined;
|
|
1165
1165
|
```
|
|
1166
1166
|
|
|
1167
|
-
Defined in: [data-structures/linked-list/skip-linked-list.ts:
|
|
1167
|
+
Defined in: [data-structures/linked-list/skip-linked-list.ts:1254](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/skip-linked-list.ts#L1254)
|
|
1168
1168
|
|
|
1169
1169
|
Finds the node for a given key, or undefined.
|
|
1170
1170
|
|
|
@@ -1186,7 +1186,7 @@ Finds the node for a given key, or undefined.
|
|
|
1186
1186
|
protected _findUpdate(key): SkipListNode<K, V>[];
|
|
1187
1187
|
```
|
|
1188
1188
|
|
|
1189
|
-
Defined in: [data-structures/linked-list/skip-linked-list.ts:
|
|
1189
|
+
Defined in: [data-structures/linked-list/skip-linked-list.ts:1236](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/skip-linked-list.ts#L1236)
|
|
1190
1190
|
|
|
1191
1191
|
Finds the update array (predecessors at each level) for a given key.
|
|
1192
1192
|
|
|
@@ -1208,7 +1208,7 @@ Finds the update array (predecessors at each level) for a given key.
|
|
|
1208
1208
|
protected _getIterator(): IterableIterator<[K, V | undefined]>;
|
|
1209
1209
|
```
|
|
1210
1210
|
|
|
1211
|
-
Defined in: [data-structures/linked-list/skip-linked-list.ts:
|
|
1211
|
+
Defined in: [data-structures/linked-list/skip-linked-list.ts:1220](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/skip-linked-list.ts#L1220)
|
|
1212
1212
|
|
|
1213
1213
|
Underlying iterator for the default iteration protocol.
|
|
1214
1214
|
|