data-structure-typed 1.49.6 → 1.49.7
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/CHANGELOG.md +1 -1
- package/README.md +16 -13
- package/README_zh-CN.md +2 -0
- package/benchmark/report.html +13 -13
- package/benchmark/report.json +148 -148
- package/dist/cjs/data-structures/binary-tree/avl-tree.d.ts +3 -3
- package/dist/cjs/data-structures/binary-tree/avl-tree.js +5 -5
- package/dist/cjs/data-structures/binary-tree/avl-tree.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/binary-tree.d.ts +3 -3
- package/dist/cjs/data-structures/binary-tree/binary-tree.js +7 -9
- package/dist/cjs/data-structures/binary-tree/binary-tree.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/bst.d.ts +3 -3
- package/dist/cjs/data-structures/binary-tree/bst.js +6 -7
- package/dist/cjs/data-structures/binary-tree/bst.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/rb-tree.d.ts +2 -2
- package/dist/cjs/data-structures/binary-tree/rb-tree.js +4 -4
- package/dist/cjs/data-structures/binary-tree/rb-tree.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/tree-multimap.d.ts +1 -1
- package/dist/cjs/data-structures/binary-tree/tree-multimap.js +3 -3
- package/dist/cjs/data-structures/binary-tree/tree-multimap.js.map +1 -1
- package/dist/cjs/data-structures/hash/hash-map.d.ts +24 -27
- package/dist/cjs/data-structures/hash/hash-map.js +35 -35
- package/dist/cjs/data-structures/hash/hash-map.js.map +1 -1
- package/dist/cjs/data-structures/hash/index.d.ts +0 -1
- package/dist/cjs/data-structures/hash/index.js +0 -1
- package/dist/cjs/data-structures/hash/index.js.map +1 -1
- package/dist/cjs/data-structures/heap/heap.d.ts +2 -1
- package/dist/cjs/data-structures/heap/heap.js +13 -13
- package/dist/cjs/data-structures/heap/heap.js.map +1 -1
- package/dist/cjs/data-structures/heap/max-heap.js +1 -1
- package/dist/cjs/data-structures/heap/max-heap.js.map +1 -1
- package/dist/cjs/data-structures/heap/min-heap.js +1 -1
- package/dist/cjs/data-structures/heap/min-heap.js.map +1 -1
- package/dist/cjs/data-structures/linked-list/doubly-linked-list.js +1 -1
- package/dist/cjs/data-structures/linked-list/doubly-linked-list.js.map +1 -1
- package/dist/cjs/data-structures/linked-list/singly-linked-list.js +1 -3
- package/dist/cjs/data-structures/linked-list/singly-linked-list.js.map +1 -1
- package/dist/cjs/data-structures/linked-list/skip-linked-list.d.ts +2 -8
- package/dist/cjs/data-structures/linked-list/skip-linked-list.js +15 -18
- package/dist/cjs/data-structures/linked-list/skip-linked-list.js.map +1 -1
- package/dist/cjs/data-structures/matrix/matrix.d.ts +2 -7
- package/dist/cjs/data-structures/matrix/matrix.js +0 -7
- package/dist/cjs/data-structures/matrix/matrix.js.map +1 -1
- package/dist/cjs/data-structures/priority-queue/max-priority-queue.js +1 -1
- package/dist/cjs/data-structures/priority-queue/max-priority-queue.js.map +1 -1
- package/dist/cjs/data-structures/priority-queue/min-priority-queue.js +1 -1
- package/dist/cjs/data-structures/priority-queue/min-priority-queue.js.map +1 -1
- package/dist/cjs/data-structures/priority-queue/priority-queue.js +1 -1
- package/dist/cjs/data-structures/priority-queue/priority-queue.js.map +1 -1
- package/dist/cjs/data-structures/queue/deque.d.ts +2 -11
- package/dist/cjs/data-structures/queue/deque.js +9 -13
- package/dist/cjs/data-structures/queue/deque.js.map +1 -1
- package/dist/cjs/data-structures/queue/queue.d.ts +13 -13
- package/dist/cjs/data-structures/queue/queue.js +29 -25
- package/dist/cjs/data-structures/queue/queue.js.map +1 -1
- package/dist/cjs/data-structures/stack/stack.js +2 -3
- package/dist/cjs/data-structures/stack/stack.js.map +1 -1
- package/dist/cjs/data-structures/trie/trie.d.ts +2 -2
- package/dist/cjs/data-structures/trie/trie.js +9 -5
- package/dist/cjs/data-structures/trie/trie.js.map +1 -1
- package/dist/cjs/types/data-structures/binary-tree/binary-tree.d.ts +2 -2
- package/dist/cjs/types/data-structures/binary-tree/bst.d.ts +1 -1
- package/dist/cjs/types/data-structures/binary-tree/tree-multimap.d.ts +1 -1
- package/dist/cjs/types/data-structures/hash/hash-map.d.ts +5 -2
- package/dist/cjs/types/data-structures/hash/index.d.ts +0 -1
- package/dist/cjs/types/data-structures/hash/index.js +0 -1
- package/dist/cjs/types/data-structures/hash/index.js.map +1 -1
- package/dist/cjs/types/data-structures/heap/heap.d.ts +1 -1
- package/dist/cjs/types/data-structures/linked-list/index.d.ts +1 -0
- package/dist/cjs/types/data-structures/linked-list/index.js +1 -0
- package/dist/cjs/types/data-structures/linked-list/index.js.map +1 -1
- package/dist/cjs/types/data-structures/linked-list/skip-linked-list.d.ts +4 -1
- package/dist/cjs/types/data-structures/matrix/index.d.ts +1 -0
- package/dist/cjs/types/data-structures/matrix/index.js +1 -0
- package/dist/cjs/types/data-structures/matrix/index.js.map +1 -1
- package/dist/cjs/types/data-structures/matrix/matrix.d.ts +7 -1
- package/dist/cjs/types/data-structures/queue/deque.d.ts +3 -1
- package/dist/cjs/types/data-structures/trie/trie.d.ts +3 -1
- package/dist/mjs/data-structures/binary-tree/avl-tree.d.ts +3 -3
- package/dist/mjs/data-structures/binary-tree/avl-tree.js +5 -5
- package/dist/mjs/data-structures/binary-tree/binary-tree.d.ts +3 -3
- package/dist/mjs/data-structures/binary-tree/binary-tree.js +7 -9
- package/dist/mjs/data-structures/binary-tree/bst.d.ts +3 -3
- package/dist/mjs/data-structures/binary-tree/bst.js +6 -7
- package/dist/mjs/data-structures/binary-tree/rb-tree.d.ts +2 -2
- package/dist/mjs/data-structures/binary-tree/rb-tree.js +4 -4
- package/dist/mjs/data-structures/binary-tree/tree-multimap.d.ts +1 -1
- package/dist/mjs/data-structures/binary-tree/tree-multimap.js +3 -3
- package/dist/mjs/data-structures/hash/hash-map.d.ts +24 -27
- package/dist/mjs/data-structures/hash/hash-map.js +35 -37
- package/dist/mjs/data-structures/hash/index.d.ts +0 -1
- package/dist/mjs/data-structures/hash/index.js +0 -1
- package/dist/mjs/data-structures/heap/heap.d.ts +2 -1
- package/dist/mjs/data-structures/heap/heap.js +19 -20
- package/dist/mjs/data-structures/heap/max-heap.js +1 -1
- package/dist/mjs/data-structures/heap/min-heap.js +1 -1
- package/dist/mjs/data-structures/linked-list/doubly-linked-list.js +1 -1
- package/dist/mjs/data-structures/linked-list/singly-linked-list.js +2 -5
- package/dist/mjs/data-structures/linked-list/skip-linked-list.d.ts +2 -8
- package/dist/mjs/data-structures/linked-list/skip-linked-list.js +16 -23
- package/dist/mjs/data-structures/matrix/matrix.d.ts +2 -7
- package/dist/mjs/data-structures/matrix/matrix.js +0 -7
- package/dist/mjs/data-structures/priority-queue/max-priority-queue.js +1 -1
- package/dist/mjs/data-structures/priority-queue/min-priority-queue.js +1 -1
- package/dist/mjs/data-structures/priority-queue/priority-queue.js +1 -1
- package/dist/mjs/data-structures/queue/deque.d.ts +2 -11
- package/dist/mjs/data-structures/queue/deque.js +9 -14
- package/dist/mjs/data-structures/queue/queue.d.ts +13 -13
- package/dist/mjs/data-structures/queue/queue.js +30 -28
- package/dist/mjs/data-structures/stack/stack.js +3 -5
- package/dist/mjs/data-structures/trie/trie.d.ts +2 -2
- package/dist/mjs/data-structures/trie/trie.js +10 -9
- package/dist/mjs/types/data-structures/binary-tree/binary-tree.d.ts +2 -2
- package/dist/mjs/types/data-structures/binary-tree/bst.d.ts +1 -1
- package/dist/mjs/types/data-structures/binary-tree/tree-multimap.d.ts +1 -1
- package/dist/mjs/types/data-structures/hash/hash-map.d.ts +5 -2
- package/dist/mjs/types/data-structures/hash/index.d.ts +0 -1
- package/dist/mjs/types/data-structures/hash/index.js +0 -1
- package/dist/mjs/types/data-structures/heap/heap.d.ts +1 -1
- package/dist/mjs/types/data-structures/linked-list/index.d.ts +1 -0
- package/dist/mjs/types/data-structures/linked-list/index.js +1 -0
- package/dist/mjs/types/data-structures/linked-list/skip-linked-list.d.ts +4 -1
- package/dist/mjs/types/data-structures/matrix/index.d.ts +1 -0
- package/dist/mjs/types/data-structures/matrix/index.js +1 -0
- package/dist/mjs/types/data-structures/matrix/matrix.d.ts +7 -1
- package/dist/mjs/types/data-structures/queue/deque.d.ts +3 -1
- package/dist/mjs/types/data-structures/trie/trie.d.ts +3 -1
- package/dist/umd/data-structure-typed.js +145 -426
- package/dist/umd/data-structure-typed.min.js +2 -2
- package/dist/umd/data-structure-typed.min.js.map +1 -1
- package/package.json +1 -1
- package/src/data-structures/binary-tree/avl-tree.ts +4 -4
- package/src/data-structures/binary-tree/binary-tree.ts +6 -10
- package/src/data-structures/binary-tree/bst.ts +5 -7
- package/src/data-structures/binary-tree/rb-tree.ts +3 -3
- package/src/data-structures/binary-tree/tree-multimap.ts +2 -2
- package/src/data-structures/hash/hash-map.ts +46 -50
- package/src/data-structures/hash/index.ts +0 -1
- package/src/data-structures/heap/heap.ts +20 -19
- package/src/data-structures/heap/max-heap.ts +1 -1
- package/src/data-structures/heap/min-heap.ts +1 -1
- package/src/data-structures/linked-list/doubly-linked-list.ts +1 -1
- package/src/data-structures/linked-list/singly-linked-list.ts +2 -5
- package/src/data-structures/linked-list/skip-linked-list.ts +15 -16
- package/src/data-structures/matrix/matrix.ts +2 -10
- package/src/data-structures/priority-queue/max-priority-queue.ts +1 -1
- package/src/data-structures/priority-queue/min-priority-queue.ts +1 -1
- package/src/data-structures/priority-queue/priority-queue.ts +1 -1
- package/src/data-structures/queue/deque.ts +11 -15
- package/src/data-structures/queue/queue.ts +29 -28
- package/src/data-structures/stack/stack.ts +3 -6
- package/src/data-structures/trie/trie.ts +10 -11
- package/src/types/data-structures/binary-tree/binary-tree.ts +2 -2
- package/src/types/data-structures/binary-tree/bst.ts +1 -1
- package/src/types/data-structures/binary-tree/tree-multimap.ts +1 -1
- package/src/types/data-structures/hash/hash-map.ts +6 -2
- package/src/types/data-structures/hash/index.ts +0 -1
- package/src/types/data-structures/heap/heap.ts +1 -1
- package/src/types/data-structures/linked-list/index.ts +1 -0
- package/src/types/data-structures/linked-list/skip-linked-list.ts +1 -1
- package/src/types/data-structures/matrix/index.ts +1 -0
- package/src/types/data-structures/matrix/matrix.ts +7 -1
- package/src/types/data-structures/queue/deque.ts +1 -1
- package/src/types/data-structures/trie/trie.ts +1 -1
- package/test/unit/data-structures/linked-list/skip-list.test.ts +1 -1
- package/test/unit/data-structures/queue/deque.test.ts +5 -5
- package/test/unit/data-structures/trie/trie.test.ts +1 -1
- package/dist/cjs/data-structures/hash/hash-table.d.ts +0 -108
- package/dist/cjs/data-structures/hash/hash-table.js +0 -282
- package/dist/cjs/data-structures/hash/hash-table.js.map +0 -1
- package/dist/cjs/types/data-structures/hash/hash-table.d.ts +0 -1
- package/dist/cjs/types/data-structures/hash/hash-table.js +0 -3
- package/dist/cjs/types/data-structures/hash/hash-table.js.map +0 -1
- package/dist/cjs/types/data-structures/matrix/matrix2d.d.ts +0 -1
- package/dist/cjs/types/data-structures/matrix/matrix2d.js +0 -3
- package/dist/cjs/types/data-structures/matrix/matrix2d.js.map +0 -1
- package/dist/cjs/types/data-structures/matrix/vector2d.d.ts +0 -1
- package/dist/cjs/types/data-structures/matrix/vector2d.js +0 -3
- package/dist/cjs/types/data-structures/matrix/vector2d.js.map +0 -1
- package/dist/mjs/data-structures/hash/hash-table.d.ts +0 -108
- package/dist/mjs/data-structures/hash/hash-table.js +0 -283
- package/dist/mjs/types/data-structures/hash/hash-table.d.ts +0 -1
- package/dist/mjs/types/data-structures/hash/hash-table.js +0 -1
- package/dist/mjs/types/data-structures/matrix/matrix2d.d.ts +0 -1
- package/dist/mjs/types/data-structures/matrix/matrix2d.js +0 -1
- package/dist/mjs/types/data-structures/matrix/vector2d.d.ts +0 -1
- package/dist/mjs/types/data-structures/matrix/vector2d.js +0 -1
- package/src/data-structures/hash/hash-table.ts +0 -318
- package/src/types/data-structures/hash/hash-table.ts +0 -1
- package/src/types/data-structures/matrix/matrix2d.ts +0 -1
- package/src/types/data-structures/matrix/vector2d.ts +0 -1
- package/test/unit/data-structures/hash/hash-table.test.ts +0 -238
|
@@ -9,23 +9,27 @@ const linked_list_1 = require("../linked-list");
|
|
|
9
9
|
* 3. Uses: Queues are commonly used to manage a series of tasks or elements that need to be processed in order. For example, managing task queues in a multi-threaded environment, or in algorithms for data structures like trees and graphs for breadth-first search.
|
|
10
10
|
* 4. Task Scheduling: Managing the order of task execution in operating systems or applications.
|
|
11
11
|
* 5. Data Buffering: Acting as a buffer for data packets in network communication.
|
|
12
|
-
* 6. Breadth-First Search (BFS): In traversal algorithms for graphs and trees, queues store
|
|
12
|
+
* 6. Breadth-First Search (BFS): In traversal algorithms for graphs and trees, queues store elements that are to be visited.
|
|
13
13
|
* 7. Real-time Queuing: Like queuing systems in banks or supermarkets.
|
|
14
14
|
*/
|
|
15
15
|
class Queue extends base_1.IterableElementBase {
|
|
16
16
|
/**
|
|
17
17
|
* The constructor initializes an instance of a class with an optional array of elements and sets the offset to 0.
|
|
18
18
|
* @param {E[]} [elements] - The `elements` parameter is an optional array of elements of type `E`. If provided, it
|
|
19
|
-
* will be used to initialize the `
|
|
19
|
+
* will be used to initialize the `_elements` property of the class. If not provided, the `_elements` property will be
|
|
20
20
|
* initialized as an empty array.
|
|
21
21
|
*/
|
|
22
|
-
constructor(elements) {
|
|
22
|
+
constructor(elements = []) {
|
|
23
23
|
super();
|
|
24
|
-
this.
|
|
24
|
+
this._elements = [];
|
|
25
25
|
this._offset = 0;
|
|
26
|
+
if (elements) {
|
|
27
|
+
for (const el of elements)
|
|
28
|
+
this.push(el);
|
|
29
|
+
}
|
|
26
30
|
}
|
|
27
|
-
get
|
|
28
|
-
return this.
|
|
31
|
+
get elements() {
|
|
32
|
+
return this._elements;
|
|
29
33
|
}
|
|
30
34
|
get offset() {
|
|
31
35
|
return this._offset;
|
|
@@ -35,18 +39,18 @@ class Queue extends base_1.IterableElementBase {
|
|
|
35
39
|
* @returns {number} The size of the array, which is the difference between the length of the array and the offset.
|
|
36
40
|
*/
|
|
37
41
|
get size() {
|
|
38
|
-
return this.
|
|
42
|
+
return this.elements.length - this.offset;
|
|
39
43
|
}
|
|
40
44
|
/**
|
|
41
45
|
* Time Complexity: O(1) - constant time as it retrieves the value at the current offset.
|
|
42
46
|
* Space Complexity: O(1) - no additional space is used.
|
|
43
47
|
*
|
|
44
|
-
* The `first` function returns the first element of the array `
|
|
45
|
-
* @returns The `get first()` method returns the first element of the data structure, represented by the `
|
|
48
|
+
* The `first` function returns the first element of the array `_elements` if it exists, otherwise it returns `undefined`.
|
|
49
|
+
* @returns The `get first()` method returns the first element of the data structure, represented by the `_elements` array at
|
|
46
50
|
* the `_offset` index. If the data structure is empty (size is 0), it returns `undefined`.
|
|
47
51
|
*/
|
|
48
52
|
get first() {
|
|
49
|
-
return this.size > 0 ? this.
|
|
53
|
+
return this.size > 0 ? this.elements[this.offset] : undefined;
|
|
50
54
|
}
|
|
51
55
|
/**
|
|
52
56
|
* Time Complexity: O(1) - constant time as it adds an element to the end of the array.
|
|
@@ -57,11 +61,11 @@ class Queue extends base_1.IterableElementBase {
|
|
|
57
61
|
* Space Complexity: O(1) - no additional space is used.
|
|
58
62
|
*
|
|
59
63
|
* The `last` function returns the last element in an array-like data structure, or undefined if the structure is empty.
|
|
60
|
-
* @returns The method `get last()` returns the last element of the `
|
|
64
|
+
* @returns The method `get last()` returns the last element of the `_elements` array if the array is not empty. If the
|
|
61
65
|
* array is empty, it returns `undefined`.
|
|
62
66
|
*/
|
|
63
67
|
get last() {
|
|
64
|
-
return this.size > 0 ? this.
|
|
68
|
+
return this.size > 0 ? this.elements[this.elements.length - 1] : undefined;
|
|
65
69
|
}
|
|
66
70
|
/**
|
|
67
71
|
* Time Complexity: O(n) - where n is the number of elements in the queue. In the worst case, it may need to shift all elements to update the offset.
|
|
@@ -91,7 +95,7 @@ class Queue extends base_1.IterableElementBase {
|
|
|
91
95
|
* @returns The `add` method is returning a `Queue<E>` object.
|
|
92
96
|
*/
|
|
93
97
|
push(element) {
|
|
94
|
-
this.
|
|
98
|
+
this.elements.push(element);
|
|
95
99
|
return true;
|
|
96
100
|
}
|
|
97
101
|
/**
|
|
@@ -111,11 +115,11 @@ class Queue extends base_1.IterableElementBase {
|
|
|
111
115
|
return undefined;
|
|
112
116
|
const first = this.first;
|
|
113
117
|
this._offset += 1;
|
|
114
|
-
if (this.offset * 2 < this.
|
|
118
|
+
if (this.offset * 2 < this.elements.length)
|
|
115
119
|
return first;
|
|
116
120
|
// only delete dequeued elements when reaching half size
|
|
117
121
|
// to decrease latency of shifting elements.
|
|
118
|
-
this.
|
|
122
|
+
this._elements = this.elements.slice(this.offset);
|
|
119
123
|
this._offset = 0;
|
|
120
124
|
return first;
|
|
121
125
|
}
|
|
@@ -127,8 +131,8 @@ class Queue extends base_1.IterableElementBase {
|
|
|
127
131
|
* Time Complexity: O(1) - constant time as it retrieves the value at the current offset.
|
|
128
132
|
* Space Complexity: O(1) - no additional space is used.
|
|
129
133
|
*
|
|
130
|
-
* The `peek` function returns the first element of the array `
|
|
131
|
-
* @returns The `peek()` method returns the first element of the data structure, represented by the `
|
|
134
|
+
* The `peek` function returns the first element of the array `_elements` if it exists, otherwise it returns `undefined`.
|
|
135
|
+
* @returns The `peek()` method returns the first element of the data structure, represented by the `_elements` array at
|
|
132
136
|
* the `_offset` index. If the data structure is empty (size is 0), it returns `undefined`.
|
|
133
137
|
*/
|
|
134
138
|
peek() {
|
|
@@ -143,7 +147,7 @@ class Queue extends base_1.IterableElementBase {
|
|
|
143
147
|
* Space Complexity: O(1) - no additional space is used.
|
|
144
148
|
*
|
|
145
149
|
* The `peekLast` function returns the last element in an array-like data structure, or undefined if the structure is empty.
|
|
146
|
-
* @returns The method `peekLast()` returns the last element of the `
|
|
150
|
+
* @returns The method `peekLast()` returns the last element of the `_elements` array if the array is not empty. If the
|
|
147
151
|
* array is empty, it returns `undefined`.
|
|
148
152
|
*/
|
|
149
153
|
peekLast() {
|
|
@@ -188,7 +192,7 @@ class Queue extends base_1.IterableElementBase {
|
|
|
188
192
|
* @param index
|
|
189
193
|
*/
|
|
190
194
|
getAt(index) {
|
|
191
|
-
return this.
|
|
195
|
+
return this.elements[index];
|
|
192
196
|
}
|
|
193
197
|
/**
|
|
194
198
|
* Time Complexity: O(1) - constant time as it retrieves the value at the specified index.
|
|
@@ -212,17 +216,17 @@ class Queue extends base_1.IterableElementBase {
|
|
|
212
216
|
* Time Complexity: O(1) - constant time as it returns a shallow copy of the internal array.
|
|
213
217
|
* Space Complexity: O(n) - where n is the number of elements in the queue.
|
|
214
218
|
*
|
|
215
|
-
* The toArray() function returns an array of elements from the current offset to the end of the
|
|
219
|
+
* The toArray() function returns an array of elements from the current offset to the end of the _elements array.
|
|
216
220
|
* @returns An array of type E is being returned.
|
|
217
221
|
*/
|
|
218
222
|
toArray() {
|
|
219
|
-
return this.
|
|
223
|
+
return this.elements.slice(this.offset);
|
|
220
224
|
}
|
|
221
225
|
/**
|
|
222
|
-
* The clear function resets the
|
|
226
|
+
* The clear function resets the elements array and offset to their initial values.
|
|
223
227
|
*/
|
|
224
228
|
clear() {
|
|
225
|
-
this.
|
|
229
|
+
this._elements = [];
|
|
226
230
|
this._offset = 0;
|
|
227
231
|
}
|
|
228
232
|
/**
|
|
@@ -237,7 +241,7 @@ class Queue extends base_1.IterableElementBase {
|
|
|
237
241
|
* @returns The `clone()` method is returning a new instance of the `Queue` class.
|
|
238
242
|
*/
|
|
239
243
|
clone() {
|
|
240
|
-
return new Queue(this.
|
|
244
|
+
return new Queue(this.elements.slice(this.offset));
|
|
241
245
|
}
|
|
242
246
|
/**
|
|
243
247
|
* Time Complexity: O(n)
|
|
@@ -302,7 +306,7 @@ class Queue extends base_1.IterableElementBase {
|
|
|
302
306
|
* Space Complexity: O(n)
|
|
303
307
|
*/
|
|
304
308
|
*_getIterator() {
|
|
305
|
-
for (const item of this.
|
|
309
|
+
for (const item of this.elements) {
|
|
306
310
|
yield item;
|
|
307
311
|
}
|
|
308
312
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queue.js","sourceRoot":"","sources":["../../../../src/data-structures/queue/queue.ts"],"names":[],"mappings":";;;AAMA,kCAA8C;AAC9C,gDAAkD;AAElD;;;;;;;;GAQG;AACH,MAAa,KAAe,SAAQ,0BAAsB;IACxD;;;;;OAKG;IACH,YAAY,
|
|
1
|
+
{"version":3,"file":"queue.js","sourceRoot":"","sources":["../../../../src/data-structures/queue/queue.ts"],"names":[],"mappings":";;;AAMA,kCAA8C;AAC9C,gDAAkD;AAElD;;;;;;;;GAQG;AACH,MAAa,KAAe,SAAQ,0BAAsB;IACxD;;;;;OAKG;IACH,YAAY,WAAwB,EAAE;QACpC,KAAK,EAAE,CAAC;QAMA,cAAS,GAAQ,EAAE,CAAC;QAMpB,YAAO,GAAW,CAAC,CAAC;QAX5B,IAAI,QAAQ,EAAE,CAAC;YACb,KAAK,MAAM,EAAE,IAAI,QAAQ;gBAAE,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC3C,CAAC;IACH,CAAC;IAID,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAID,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED;;;OAGG;IACH,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;IAC5C,CAAC;IAED;;;;;;;OAOG;IACH,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAChE,CAAC;IAED;;;OAGG;IAEH;;;;;;;OAOG;IACH,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC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K,MAAM,EAAE,IAAI,IAAI,EAAE,CAAC;YACtB,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;YACvD,KAAK,EAAE,CAAC;QACV,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;;OAGG;IAEM,CAAE,YAAY;QACrB,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YACjC,MAAM,IAAI,CAAC;QACb,CAAC;IACH,CAAC;CACF;AA9UD,sBA8UC;AAED;;;;;GAKG;AACH,MAAa,eAAyB,SAAQ,8BAAmB;IAC/D;;;OAGG;IACH,IAAI,KAAK;;QACP,OAAO,MAAA,IAAI,CAAC,IAAI,0CAAE,KAAK,CAAC;IAC1B,CAAC;IAED;;;OAGG;IACH,OAAO,CAAC,KAAQ;QACd,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC1B,CAAC;IAED;;;OAGG;IACH,OAAO;QACL,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC;IACtB,CAAC;IAED;;;OAGG;IACH,IAAI;QACF,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;CACF;AAhCD,0CAgCC"}
|
|
@@ -17,13 +17,12 @@ class Stack extends base_1.IterableElementBase {
|
|
|
17
17
|
* of elements of type `E`. It is used to initialize the `_elements` property of the class. If the `elements` parameter
|
|
18
18
|
* is provided and is an array, it is assigned to the `_elements
|
|
19
19
|
*/
|
|
20
|
-
constructor(elements) {
|
|
20
|
+
constructor(elements = []) {
|
|
21
21
|
super();
|
|
22
22
|
this._elements = [];
|
|
23
23
|
if (elements) {
|
|
24
|
-
for (const el of elements)
|
|
24
|
+
for (const el of elements)
|
|
25
25
|
this.push(el);
|
|
26
|
-
}
|
|
27
26
|
}
|
|
28
27
|
}
|
|
29
28
|
get elements() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stack.js","sourceRoot":"","sources":["../../../../src/data-structures/stack/stack.ts"],"names":[],"mappings":";;;AAQA,kCAA8C;AAE9C;;;;;;;GAOG;AACH,MAAa,KAAe,SAAQ,0BAAsB;IACxD;;;;;OAKG;IACH,YAAY,
|
|
1
|
+
{"version":3,"file":"stack.js","sourceRoot":"","sources":["../../../../src/data-structures/stack/stack.ts"],"names":[],"mappings":";;;AAQA,kCAA8C;AAE9C;;;;;;;GAOG;AACH,MAAa,KAAe,SAAQ,0BAAsB;IACxD;;;;;OAKG;IACH,YAAY,WAAwB,EAAE;QACpC,KAAK,EAAE,CAAC;QAMA,cAAS,GAAQ,EAAE,CAAC;QAL5B,IAAI,QAAQ,EAAE,CAAC;YACb,KAAK,MAAM,EAAE,IAAI,QAAQ;gBAAE,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC3C,CAAC;IACH,CAAC;IAID,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED;;;OAGG;IAEH;;;OAGG;IACH,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;IAC9B,CAAC;IAED;;;;;;;;OAQG;IACH,MAAM,CAAC,SAAS,CAAI,QAAa;QAC/B,OAAO,IAAI,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC7B,CAAC;IAED;;;OAGG;IACH,OAAO;QACL,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,CAAC;IACpC,CAAC;IAED;;;OAGG;IAEH;;;;;;OAMG;IACH,IAAI;QACF,IAAI,IAAI,CAAC,OAAO,EAAE;YAAE,OAAO,SAAS,CAAC;QAErC,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACjD,CAAC;IAED;;;OAGG;IAEH;;;;;;;OAOG;IACH,IAAI,CAAC,OAAU;QACb,IAAI,CAAC,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CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;YACvD,KAAK,EAAE,CAAC;QACV,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;;OAGG;IACM,CAAE,YAAY;QACrB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAC9C,MAAM,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QACzB,CAAC;IACH,CAAC;CACF;AA1ND,sBA0NC"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @copyright Copyright (c) 2022 Tyler Zeng <zrwusa@gmail.com>
|
|
6
6
|
* @license MIT License
|
|
7
7
|
*/
|
|
8
|
-
import type { ElementCallback } from '../../types';
|
|
8
|
+
import type { ElementCallback, TrieOptions } from '../../types';
|
|
9
9
|
import { IterableElementBase } from '../base';
|
|
10
10
|
/**
|
|
11
11
|
* TrieNode represents a node in the Trie data structure. It holds a character key, a map of children nodes,
|
|
@@ -31,7 +31,7 @@ export declare class TrieNode {
|
|
|
31
31
|
* 11. Text Word Frequency Count: Counting and storing the frequency of words in a large amount of text data."
|
|
32
32
|
*/
|
|
33
33
|
export declare class Trie extends IterableElementBase<string> {
|
|
34
|
-
constructor(words?: string
|
|
34
|
+
constructor(words?: Iterable<string>, options?: TrieOptions);
|
|
35
35
|
protected _size: number;
|
|
36
36
|
get size(): number;
|
|
37
37
|
protected _caseSensitive: boolean;
|
|
@@ -28,15 +28,19 @@ exports.TrieNode = TrieNode;
|
|
|
28
28
|
* 11. Text Word Frequency Count: Counting and storing the frequency of words in a large amount of text data."
|
|
29
29
|
*/
|
|
30
30
|
class Trie extends base_1.IterableElementBase {
|
|
31
|
-
constructor(words
|
|
31
|
+
constructor(words = [], options) {
|
|
32
32
|
super();
|
|
33
|
-
this._root = new TrieNode('');
|
|
34
|
-
this._caseSensitive = caseSensitive;
|
|
35
33
|
this._size = 0;
|
|
34
|
+
this._caseSensitive = true;
|
|
35
|
+
this._root = new TrieNode('');
|
|
36
|
+
if (options) {
|
|
37
|
+
const { caseSensitive } = options;
|
|
38
|
+
if (caseSensitive !== undefined)
|
|
39
|
+
this._caseSensitive = caseSensitive;
|
|
40
|
+
}
|
|
36
41
|
if (words) {
|
|
37
|
-
for (const word of words)
|
|
42
|
+
for (const word of words)
|
|
38
43
|
this.add(word);
|
|
39
|
-
}
|
|
40
44
|
}
|
|
41
45
|
}
|
|
42
46
|
get size() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trie.js","sourceRoot":"","sources":["../../../../src/data-structures/trie/trie.ts"],"names":[],"mappings":";;;AAQA,kCAA8C;AAE9C;;;GAGG;AACH,MAAa,QAAQ;IAKnB,YAAY,GAAW;QACrB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,QAAQ,GAAG,IAAI,GAAG,EAAoB,CAAC;IAC9C,CAAC;CACF;AAVD,4BAUC;AAED;;;;;;;;;;;;GAYG;AACH,MAAa,IAAK,SAAQ,0BAA2B;IACnD,YAAY,
|
|
1
|
+
{"version":3,"file":"trie.js","sourceRoot":"","sources":["../../../../src/data-structures/trie/trie.ts"],"names":[],"mappings":";;;AAQA,kCAA8C;AAE9C;;;GAGG;AACH,MAAa,QAAQ;IAKnB,YAAY,GAAW;QACrB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,QAAQ,GAAG,IAAI,GAAG,EAAoB,CAAC;IAC9C,CAAC;CACF;AAVD,4BAUC;AAED;;;;;;;;;;;;GAYG;AACH,MAAa,IAAK,SAAQ,0BAA2B;IACnD,YAAY,QAA0B,EAAE,EAAE,OAAqB;QAC7D,KAAK,EA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{ IterationType } from "../../common";
|
|
|
3
3
|
export type BinaryTreeNodeNested<K, V> = BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
|
|
4
4
|
export type BinaryTreeNested<K, V, N extends BinaryTreeNode<K, V, N>> = BinaryTree<K, V, N, BinaryTree<K, V, N, BinaryTree<K, V, N, BinaryTree<K, V, N, BinaryTree<K, V, N, BinaryTree<K, V, N, BinaryTree<K, V, N, BinaryTree<K, V, N, BinaryTree<K, V, N, BinaryTree<K, V, N, BinaryTree<K, V, N, BinaryTree<K, V, N, BinaryTree<K, V, N, BinaryTree<K, V, N, BinaryTree<K, V, N, BinaryTree<K, V, N, BinaryTree<K, V, N, BinaryTree<K, V, N, BinaryTree<K, V, N, BinaryTree<K, V, N, BinaryTree<K, V, N, BinaryTree<K, V, N, BinaryTree<K, V, N, BinaryTree<K, V, N, BinaryTree<K, V, N, BinaryTree<K, V, N, BinaryTree<K, V, N, BinaryTree<K, V, N, BinaryTree<K, V, N, BinaryTree<K, V, N, BinaryTree<K, V, N, BinaryTree<K, V, N, BinaryTree<K, V, N, BinaryTree<K, V, N, BinaryTree<K, V, N, BinaryTree<K, V, N, BinaryTree<K, V, N, BinaryTree<K, V, N, BinaryTree<K, V, N, BinaryTree<K, V, N, BinaryTree<K, V, N, BinaryTree<K, V, N, BinaryTree<K, V, N, BinaryTree<K, V, N, BinaryTree<K, V, N, BinaryTree<K, V, N, BinaryTree<K, V, N, BinaryTree<K, V, N, BinaryTree<K, V, N, BinaryTree<K, V, N, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
|
|
5
5
|
export type BinaryTreeOptions<K> = {
|
|
6
|
-
iterationType
|
|
7
|
-
extractor
|
|
6
|
+
iterationType?: IterationType;
|
|
7
|
+
extractor?: (key: K) => number;
|
|
8
8
|
};
|
|
@@ -4,5 +4,5 @@ import { BSTVariant } from "../../common";
|
|
|
4
4
|
export type BSTNodeNested<K, V> = BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
|
|
5
5
|
export type BSTNested<K, V, N extends BSTNode<K, V, N>> = BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, BST<K, V, N, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
|
|
6
6
|
export type BSTOptions<K> = BinaryTreeOptions<K> & {
|
|
7
|
-
variant
|
|
7
|
+
variant?: BSTVariant;
|
|
8
8
|
};
|
|
@@ -2,4 +2,4 @@ import { TreeMultimap, TreeMultimapNode } from '../../../data-structures';
|
|
|
2
2
|
import type { AVLTreeOptions } from './avl-tree';
|
|
3
3
|
export type TreeMultimapNodeNested<K, V> = TreeMultimapNode<K, V, TreeMultimapNode<K, V, TreeMultimapNode<K, V, TreeMultimapNode<K, V, TreeMultimapNode<K, V, TreeMultimapNode<K, V, TreeMultimapNode<K, V, TreeMultimapNode<K, V, TreeMultimapNode<K, V, TreeMultimapNode<K, V, TreeMultimapNode<K, V, TreeMultimapNode<K, V, TreeMultimapNode<K, V, TreeMultimapNode<K, V, TreeMultimapNode<K, V, TreeMultimapNode<K, V, TreeMultimapNode<K, V, TreeMultimapNode<K, V, TreeMultimapNode<K, V, TreeMultimapNode<K, V, TreeMultimapNode<K, V, TreeMultimapNode<K, V, TreeMultimapNode<K, V, TreeMultimapNode<K, V, TreeMultimapNode<K, V, TreeMultimapNode<K, V, TreeMultimapNode<K, V, TreeMultimapNode<K, V, TreeMultimapNode<K, V, TreeMultimapNode<K, V, TreeMultimapNode<K, V, TreeMultimapNode<K, V, TreeMultimapNode<K, V, TreeMultimapNode<K, V, TreeMultimapNode<K, V, TreeMultimapNode<K, V, TreeMultimapNode<K, V, TreeMultimapNode<K, V, TreeMultimapNode<K, V, TreeMultimapNode<K, V, TreeMultimapNode<K, V, TreeMultimapNode<K, V, TreeMultimapNode<K, V, TreeMultimapNode<K, V, TreeMultimapNode<K, V, TreeMultimapNode<K, V, TreeMultimapNode<K, V, TreeMultimapNode<K, V, TreeMultimapNode<K, V, TreeMultimapNode<K, V, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
|
|
4
4
|
export type TreeMultimapNested<K, V, N extends TreeMultimapNode<K, V, N>> = TreeMultimap<K, V, N, TreeMultimap<K, V, N, TreeMultimap<K, V, N, TreeMultimap<K, V, N, TreeMultimap<K, V, N, TreeMultimap<K, V, N, TreeMultimap<K, V, N, TreeMultimap<K, V, N, TreeMultimap<K, V, N, TreeMultimap<K, V, N, TreeMultimap<K, V, N, TreeMultimap<K, V, N, TreeMultimap<K, V, N, TreeMultimap<K, V, N, TreeMultimap<K, V, N, TreeMultimap<K, V, N, TreeMultimap<K, V, N, TreeMultimap<K, V, N, TreeMultimap<K, V, N, TreeMultimap<K, V, N, TreeMultimap<K, V, N, TreeMultimap<K, V, N, TreeMultimap<K, V, N, TreeMultimap<K, V, N, TreeMultimap<K, V, N, TreeMultimap<K, V, N, TreeMultimap<K, V, N, TreeMultimap<K, V, N, TreeMultimap<K, V, N, TreeMultimap<K, V, N, TreeMultimap<K, V, N, TreeMultimap<K, V, N, TreeMultimap<K, V, N, TreeMultimap<K, V, N, TreeMultimap<K, V, N, TreeMultimap<K, V, N, TreeMultimap<K, V, N, TreeMultimap<K, V, N, TreeMultimap<K, V, N, TreeMultimap<K, V, N, TreeMultimap<K, V, N, TreeMultimap<K, V, N, TreeMultimap<K, V, N, TreeMultimap<K, V, N, TreeMultimap<K, V, N, TreeMultimap<K, V, N, TreeMultimap<K, V, N, TreeMultimap<K, V, N, TreeMultimap<K, V, N, TreeMultimap<K, V, N, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
|
|
5
|
-
export type TreeMultimapOptions<K> =
|
|
5
|
+
export type TreeMultimapOptions<K> = AVLTreeOptions<K> & {};
|
|
@@ -4,9 +4,12 @@ export type HashMapLinkedNode<K, V> = {
|
|
|
4
4
|
next: HashMapLinkedNode<K, V>;
|
|
5
5
|
prev: HashMapLinkedNode<K, V>;
|
|
6
6
|
};
|
|
7
|
+
export type LinkedHashMapOptions<K> = {
|
|
8
|
+
hashFn?: (key: K) => string;
|
|
9
|
+
objHashFn?: (key: K) => object;
|
|
10
|
+
};
|
|
7
11
|
export type HashMapOptions<K> = {
|
|
8
|
-
hashFn
|
|
9
|
-
objHashFn: (key: K) => object;
|
|
12
|
+
hashFn?: (key: K) => string;
|
|
10
13
|
};
|
|
11
14
|
export type HashMapStoreItem<K, V> = {
|
|
12
15
|
key: K;
|
|
@@ -15,5 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./hash-map"), exports);
|
|
18
|
-
__exportStar(require("./hash-table"), exports);
|
|
19
18
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/types/data-structures/hash/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/types/data-structures/hash/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B"}
|
|
@@ -16,4 +16,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./singly-linked-list"), exports);
|
|
18
18
|
__exportStar(require("./doubly-linked-list"), exports);
|
|
19
|
+
__exportStar(require("./skip-linked-list"), exports);
|
|
19
20
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/types/data-structures/linked-list/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC;AACrC,uDAAqC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/types/data-structures/linked-list/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC;AACrC,uDAAqC;AACrC,qDAAmC"}
|
|
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./navigator"), exports);
|
|
18
|
+
__exportStar(require("./matrix"), exports);
|
|
18
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/types/data-structures/matrix/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/types/data-structures/matrix/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,2CAAyB"}
|
|
@@ -23,15 +23,15 @@ export declare class AVLTreeNode<K = any, V = any, N extends AVLTreeNode<K, V, N
|
|
|
23
23
|
*/
|
|
24
24
|
export declare class AVLTree<K = any, V = any, N extends AVLTreeNode<K, V, N> = AVLTreeNode<K, V, AVLTreeNodeNested<K, V>>, TREE extends AVLTree<K, V, N, TREE> = AVLTree<K, V, N, AVLTreeNested<K, V, N>>> extends BST<K, V, N, TREE> implements IBinaryTree<K, V, N, TREE> {
|
|
25
25
|
/**
|
|
26
|
-
* The constructor function initializes an AVLTree object with optional
|
|
27
|
-
* @param [
|
|
26
|
+
* The constructor function initializes an AVLTree object with optional keysOrNodesOrEntries and options.
|
|
27
|
+
* @param [keysOrNodesOrEntries] - The `keysOrNodesOrEntries` parameter is an optional iterable of `KeyOrNodeOrEntry<K, V, N>`
|
|
28
28
|
* objects. It represents a collection of nodes that will be added to the AVL tree during
|
|
29
29
|
* initialization.
|
|
30
30
|
* @param [options] - The `options` parameter is an optional object that allows you to customize the
|
|
31
31
|
* behavior of the AVL tree. It is of type `Partial<AVLTreeOptions>`, which means that you can
|
|
32
32
|
* provide only a subset of the properties defined in the `AVLTreeOptions` interface.
|
|
33
33
|
*/
|
|
34
|
-
constructor(
|
|
34
|
+
constructor(keysOrNodesOrEntries?: Iterable<KeyOrNodeOrEntry<K, V, N>>, options?: AVLTreeOptions<K>);
|
|
35
35
|
/**
|
|
36
36
|
* The function creates a new AVL tree node with the specified key and value.
|
|
37
37
|
* @param {K} key - The key parameter is the key value that will be associated with
|
|
@@ -24,18 +24,18 @@ export class AVLTreeNode extends BSTNode {
|
|
|
24
24
|
*/
|
|
25
25
|
export class AVLTree extends BST {
|
|
26
26
|
/**
|
|
27
|
-
* The constructor function initializes an AVLTree object with optional
|
|
28
|
-
* @param [
|
|
27
|
+
* The constructor function initializes an AVLTree object with optional keysOrNodesOrEntries and options.
|
|
28
|
+
* @param [keysOrNodesOrEntries] - The `keysOrNodesOrEntries` parameter is an optional iterable of `KeyOrNodeOrEntry<K, V, N>`
|
|
29
29
|
* objects. It represents a collection of nodes that will be added to the AVL tree during
|
|
30
30
|
* initialization.
|
|
31
31
|
* @param [options] - The `options` parameter is an optional object that allows you to customize the
|
|
32
32
|
* behavior of the AVL tree. It is of type `Partial<AVLTreeOptions>`, which means that you can
|
|
33
33
|
* provide only a subset of the properties defined in the `AVLTreeOptions` interface.
|
|
34
34
|
*/
|
|
35
|
-
constructor(
|
|
35
|
+
constructor(keysOrNodesOrEntries = [], options) {
|
|
36
36
|
super([], options);
|
|
37
|
-
if (
|
|
38
|
-
super.addMany(
|
|
37
|
+
if (keysOrNodesOrEntries)
|
|
38
|
+
super.addMany(keysOrNodesOrEntries);
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
41
41
|
* The function creates a new AVL tree node with the specified key and value.
|
|
@@ -41,15 +41,15 @@ export declare class BinaryTreeNode<K = any, V = any, N extends BinaryTreeNode<K
|
|
|
41
41
|
export declare class BinaryTree<K = any, V = any, N extends BinaryTreeNode<K, V, N> = BinaryTreeNode<K, V, BinaryTreeNodeNested<K, V>>, TREE extends BinaryTree<K, V, N, TREE> = BinaryTree<K, V, N, BinaryTreeNested<K, V, N>>> extends IterableEntryBase<K, V | undefined> implements IBinaryTree<K, V, N, TREE> {
|
|
42
42
|
iterationType: IterationType;
|
|
43
43
|
/**
|
|
44
|
-
* The constructor function initializes a binary tree object with optional
|
|
45
|
-
* @param [
|
|
44
|
+
* The constructor function initializes a binary tree object with optional keysOrNodesOrEntries and options.
|
|
45
|
+
* @param [keysOrNodesOrEntries] - An optional iterable of KeyOrNodeOrEntry objects. These objects represent the
|
|
46
46
|
* nodes to be added to the binary tree.
|
|
47
47
|
* @param [options] - The `options` parameter is an optional object that can contain additional
|
|
48
48
|
* configuration options for the binary tree. In this case, it is of type
|
|
49
49
|
* `Partial<BinaryTreeOptions>`, which means that not all properties of `BinaryTreeOptions` are
|
|
50
50
|
* required.
|
|
51
51
|
*/
|
|
52
|
-
constructor(
|
|
52
|
+
constructor(keysOrNodesOrEntries?: Iterable<KeyOrNodeOrEntry<K, V, N>>, options?: BinaryTreeOptions<K>);
|
|
53
53
|
protected _extractor: (key: K) => number;
|
|
54
54
|
get extractor(): (key: K) => number;
|
|
55
55
|
protected _root?: N | null;
|
|
@@ -70,28 +70,26 @@ export class BinaryTreeNode {
|
|
|
70
70
|
export class BinaryTree extends IterableEntryBase {
|
|
71
71
|
iterationType = IterationType.ITERATIVE;
|
|
72
72
|
/**
|
|
73
|
-
* The constructor function initializes a binary tree object with optional
|
|
74
|
-
* @param [
|
|
73
|
+
* The constructor function initializes a binary tree object with optional keysOrNodesOrEntries and options.
|
|
74
|
+
* @param [keysOrNodesOrEntries] - An optional iterable of KeyOrNodeOrEntry objects. These objects represent the
|
|
75
75
|
* nodes to be added to the binary tree.
|
|
76
76
|
* @param [options] - The `options` parameter is an optional object that can contain additional
|
|
77
77
|
* configuration options for the binary tree. In this case, it is of type
|
|
78
78
|
* `Partial<BinaryTreeOptions>`, which means that not all properties of `BinaryTreeOptions` are
|
|
79
79
|
* required.
|
|
80
80
|
*/
|
|
81
|
-
constructor(
|
|
81
|
+
constructor(keysOrNodesOrEntries = [], options) {
|
|
82
82
|
super();
|
|
83
83
|
if (options) {
|
|
84
84
|
const { iterationType, extractor } = options;
|
|
85
|
-
if (iterationType)
|
|
85
|
+
if (iterationType)
|
|
86
86
|
this.iterationType = iterationType;
|
|
87
|
-
|
|
88
|
-
if (extractor) {
|
|
87
|
+
if (extractor)
|
|
89
88
|
this._extractor = extractor;
|
|
90
|
-
}
|
|
91
89
|
}
|
|
92
90
|
this._size = 0;
|
|
93
|
-
if (
|
|
94
|
-
this.addMany(
|
|
91
|
+
if (keysOrNodesOrEntries)
|
|
92
|
+
this.addMany(keysOrNodesOrEntries);
|
|
95
93
|
}
|
|
96
94
|
_extractor = (key) => Number(key);
|
|
97
95
|
get extractor() {
|
|
@@ -45,13 +45,13 @@ export declare class BSTNode<K = any, V = any, N extends BSTNode<K, V, N> = BSTN
|
|
|
45
45
|
export declare class BST<K = any, V = any, N extends BSTNode<K, V, N> = BSTNode<K, V, BSTNodeNested<K, V>>, TREE extends BST<K, V, N, TREE> = BST<K, V, N, BSTNested<K, V, N>>> extends BinaryTree<K, V, N, TREE> implements IBinaryTree<K, V, N, TREE> {
|
|
46
46
|
/**
|
|
47
47
|
* This is the constructor function for a binary search tree class in TypeScript, which initializes
|
|
48
|
-
* the tree with optional
|
|
49
|
-
* @param [
|
|
48
|
+
* the tree with optional keysOrNodesOrEntries and options.
|
|
49
|
+
* @param [keysOrNodesOrEntries] - An optional iterable of KeyOrNodeOrEntry objects that will be added to the
|
|
50
50
|
* binary search tree.
|
|
51
51
|
* @param [options] - The `options` parameter is an optional object that can contain additional
|
|
52
52
|
* configuration options for the binary search tree. It can have the following properties:
|
|
53
53
|
*/
|
|
54
|
-
constructor(
|
|
54
|
+
constructor(keysOrNodesOrEntries?: Iterable<KeyOrNodeOrEntry<K, V, N>>, options?: BSTOptions<K>);
|
|
55
55
|
protected _root?: N;
|
|
56
56
|
get root(): N | undefined;
|
|
57
57
|
protected _variant: BSTVariant;
|
|
@@ -56,23 +56,22 @@ export class BSTNode extends BinaryTreeNode {
|
|
|
56
56
|
export class BST extends BinaryTree {
|
|
57
57
|
/**
|
|
58
58
|
* This is the constructor function for a binary search tree class in TypeScript, which initializes
|
|
59
|
-
* the tree with optional
|
|
60
|
-
* @param [
|
|
59
|
+
* the tree with optional keysOrNodesOrEntries and options.
|
|
60
|
+
* @param [keysOrNodesOrEntries] - An optional iterable of KeyOrNodeOrEntry objects that will be added to the
|
|
61
61
|
* binary search tree.
|
|
62
62
|
* @param [options] - The `options` parameter is an optional object that can contain additional
|
|
63
63
|
* configuration options for the binary search tree. It can have the following properties:
|
|
64
64
|
*/
|
|
65
|
-
constructor(
|
|
65
|
+
constructor(keysOrNodesOrEntries = [], options) {
|
|
66
66
|
super([], options);
|
|
67
67
|
if (options) {
|
|
68
68
|
const { variant } = options;
|
|
69
|
-
if (variant)
|
|
69
|
+
if (variant)
|
|
70
70
|
this._variant = variant;
|
|
71
|
-
}
|
|
72
71
|
}
|
|
73
72
|
this._root = undefined;
|
|
74
|
-
if (
|
|
75
|
-
this.addMany(
|
|
73
|
+
if (keysOrNodesOrEntries)
|
|
74
|
+
this.addMany(keysOrNodesOrEntries);
|
|
76
75
|
}
|
|
77
76
|
_root;
|
|
78
77
|
get root() {
|
|
@@ -24,7 +24,7 @@ export declare class RedBlackTree<K = any, V = any, N extends RedBlackTreeNode<K
|
|
|
24
24
|
/**
|
|
25
25
|
* This is the constructor function for a Red-Black Tree data structure in TypeScript, which
|
|
26
26
|
* initializes the tree with optional nodes and options.
|
|
27
|
-
* @param [
|
|
27
|
+
* @param [keysOrNodesOrEntries] - The `keysOrNodesOrEntries` parameter is an optional iterable of `KeyOrNodeOrEntry<K, V, N>`
|
|
28
28
|
* objects. It represents the initial nodes that will be added to the RBTree during its
|
|
29
29
|
* construction. If this parameter is provided, the `addMany` method is called to add all the
|
|
30
30
|
* nodes to the
|
|
@@ -32,7 +32,7 @@ export declare class RedBlackTree<K = any, V = any, N extends RedBlackTreeNode<K
|
|
|
32
32
|
* behavior of the RBTree. It is of type `Partial<RBTreeOptions>`, which means that you can provide
|
|
33
33
|
* only a subset of the properties defined in the `RBTreeOptions` interface.
|
|
34
34
|
*/
|
|
35
|
-
constructor(
|
|
35
|
+
constructor(keysOrNodesOrEntries?: Iterable<KeyOrNodeOrEntry<K, V, N>>, options?: RBTreeOptions<K>);
|
|
36
36
|
protected _root: N;
|
|
37
37
|
get root(): N;
|
|
38
38
|
protected _size: number;
|