data-structure-typed 1.15.2 → 1.17.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/README.md +24 -24
- package/dist/data-structures/heap/heap.d.ts +30 -15
- package/dist/data-structures/heap/heap.js +60 -15
- package/dist/data-structures/heap/max-heap.d.ts +3 -3
- package/dist/data-structures/heap/min-heap.d.ts +3 -3
- package/dist/data-structures/index.d.ts +1 -0
- package/dist/data-structures/index.js +1 -0
- package/dist/data-structures/linked-list/doubly-linked-list.d.ts +195 -68
- package/dist/data-structures/linked-list/doubly-linked-list.js +456 -244
- package/dist/data-structures/linked-list/singly-linked-list.d.ts +126 -241
- package/dist/data-structures/linked-list/singly-linked-list.js +331 -628
- package/dist/data-structures/priority-queue/max-priority-queue.d.ts +4 -5
- package/dist/data-structures/priority-queue/max-priority-queue.js +30 -6
- package/dist/data-structures/priority-queue/min-priority-queue.d.ts +4 -5
- package/dist/data-structures/priority-queue/min-priority-queue.js +31 -6
- package/dist/data-structures/priority-queue/priority-queue.d.ts +13 -2
- package/dist/data-structures/priority-queue/priority-queue.js +28 -22
- package/dist/data-structures/tree/index.d.ts +1 -0
- package/dist/data-structures/tree/index.js +17 -0
- package/dist/data-structures/tree/tree.d.ts +9 -0
- package/dist/data-structures/tree/tree.js +52 -0
- package/dist/data-structures/types/binary-tree.d.ts +0 -5
- package/dist/data-structures/types/heap.d.ts +0 -4
- package/dist/utils/types/utils.d.ts +1 -0
- package/docs/.nojekyll +1 -0
- package/docs/assets/highlight.css +92 -0
- package/docs/assets/main.js +58 -0
- package/docs/assets/search.js +1 -0
- package/docs/assets/style.css +1367 -0
- package/docs/classes/AVLTree.html +2191 -0
- package/docs/classes/AVLTreeNode.html +573 -0
- package/docs/classes/AaTree.html +149 -0
- package/docs/classes/AbstractEdge.html +268 -0
- package/docs/classes/AbstractGraph.html +926 -0
- package/docs/classes/AbstractVertex.html +214 -0
- package/docs/classes/ArrayDeque.html +416 -0
- package/docs/classes/BST.html +2037 -0
- package/docs/classes/BSTNode.html +569 -0
- package/docs/classes/BTree.html +149 -0
- package/docs/classes/BinaryIndexedTree.html +288 -0
- package/docs/classes/BinaryTree.html +1826 -0
- package/docs/classes/BinaryTreeNode.html +532 -0
- package/docs/classes/Character.html +197 -0
- package/docs/classes/CoordinateMap.html +468 -0
- package/docs/classes/CoordinateSet.html +429 -0
- package/docs/classes/Deque.html +897 -0
- package/docs/classes/DirectedEdge.html +353 -0
- package/docs/classes/DirectedGraph.html +1242 -0
- package/docs/classes/DirectedVertex.html +225 -0
- package/docs/classes/DoublyLinkedList.html +891 -0
- package/docs/classes/DoublyLinkedListNode.html +274 -0
- package/docs/classes/Heap.html +481 -0
- package/docs/classes/HeapItem.html +232 -0
- package/docs/classes/Matrix2D.html +479 -0
- package/docs/classes/MatrixNTI2D.html +217 -0
- package/docs/classes/MaxHeap.html +499 -0
- package/docs/classes/MaxPriorityQueue.html +808 -0
- package/docs/classes/MinHeap.html +500 -0
- package/docs/classes/MinPriorityQueue.html +810 -0
- package/docs/classes/Navigator.html +290 -0
- package/docs/classes/ObjectDeque.html +422 -0
- package/docs/classes/PriorityQueue.html +732 -0
- package/docs/classes/Queue.html +369 -0
- package/docs/classes/RBTree.html +149 -0
- package/docs/classes/SegmentTree.html +344 -0
- package/docs/classes/SegmentTreeNode.html +417 -0
- package/docs/classes/SinglyLinkedList.html +718 -0
- package/docs/classes/SinglyLinkedListNode.html +247 -0
- package/docs/classes/SplayTree.html +149 -0
- package/docs/classes/Stack.html +345 -0
- package/docs/classes/TreeMultiSet.html +2035 -0
- package/docs/classes/TreeNode.html +235 -0
- package/docs/classes/Trie.html +349 -0
- package/docs/classes/TrieNode.html +257 -0
- package/docs/classes/TwoThreeTree.html +149 -0
- package/docs/classes/UndirectedEdge.html +312 -0
- package/docs/classes/UndirectedGraph.html +1079 -0
- package/docs/classes/UndirectedVertex.html +225 -0
- package/docs/classes/Vector2D.html +782 -0
- package/docs/enums/CP.html +158 -0
- package/docs/enums/FamilyPosition.html +158 -0
- package/docs/enums/LoopType.html +159 -0
- package/docs/index.html +493 -0
- package/docs/interfaces/AVLTreeDeleted.html +160 -0
- package/docs/interfaces/HeapOptions.html +166 -0
- package/docs/interfaces/IDirectedGraph.html +242 -0
- package/docs/interfaces/IGraph.html +426 -0
- package/docs/interfaces/NavigatorParams.html +196 -0
- package/docs/interfaces/PriorityQueueOptions.html +167 -0
- package/docs/modules.html +216 -0
- package/docs/types/BSTComparator.html +139 -0
- package/docs/types/BSTDeletedResult.html +136 -0
- package/docs/types/BinaryTreeDeleted.html +136 -0
- package/docs/types/BinaryTreeNodeId.html +124 -0
- package/docs/types/BinaryTreeNodePropertyName.html +124 -0
- package/docs/types/DFSOrderPattern.html +124 -0
- package/docs/types/DijkstraResult.html +144 -0
- package/docs/types/Direction.html +124 -0
- package/docs/types/DoublyLinkedListGetBy.html +124 -0
- package/docs/types/NodeOrPropertyName.html +124 -0
- package/docs/types/PriorityQueueComparator.html +144 -0
- package/docs/types/PriorityQueueDFSOrderPattern.html +124 -0
- package/docs/types/ResultByProperty.html +129 -0
- package/docs/types/ResultsByProperty.html +129 -0
- package/docs/types/SegmentTreeNodeVal.html +124 -0
- package/docs/types/SpecifyOptional.html +131 -0
- package/docs/types/Thunk.html +132 -0
- package/docs/types/ToThunkFn.html +132 -0
- package/docs/types/TopologicalStatus.html +124 -0
- package/docs/types/TreeMultiSetDeletedResult.html +136 -0
- package/docs/types/TrlAsyncFn.html +137 -0
- package/docs/types/TrlFn.html +137 -0
- package/docs/types/Turning.html +124 -0
- package/docs/types/VertexId.html +124 -0
- package/{tests/unit/data-structures/binary-tree → notes}/bst.test.ts +37 -50
- package/notes/note.md +23 -0
- package/package.json +1 -3
- package/.idea/data-structure-typed.iml +0 -14
- package/.idea/modules.xml +0 -8
- package/.idea/vcs.xml +0 -6
- package/src/assets/complexities-diff.jpg +0 -0
- package/src/assets/data-structure-complexities.jpg +0 -0
- package/src/assets/logo.png +0 -0
- package/src/assets/overview-diagram-of-data-structures.png +0 -0
- package/src/data-structures/binary-tree/aa-tree.ts +0 -3
- package/src/data-structures/binary-tree/avl-tree.ts +0 -293
- package/src/data-structures/binary-tree/b-tree.ts +0 -3
- package/src/data-structures/binary-tree/binary-indexed-tree.ts +0 -69
- package/src/data-structures/binary-tree/binary-tree.ts +0 -1492
- package/src/data-structures/binary-tree/bst.ts +0 -497
- package/src/data-structures/binary-tree/diagrams/avl-tree-inserting.gif +0 -0
- package/src/data-structures/binary-tree/diagrams/bst-rotation.gif +0 -0
- package/src/data-structures/binary-tree/diagrams/segment-tree.png +0 -0
- package/src/data-structures/binary-tree/index.ts +0 -11
- package/src/data-structures/binary-tree/rb-tree.ts +0 -3
- package/src/data-structures/binary-tree/segment-tree.ts +0 -267
- package/src/data-structures/binary-tree/splay-tree.ts +0 -3
- package/src/data-structures/binary-tree/tree-multiset.ts +0 -53
- package/src/data-structures/binary-tree/two-three-tree.ts +0 -3
- package/src/data-structures/diagrams/README.md +0 -5
- package/src/data-structures/graph/abstract-graph.ts +0 -958
- package/src/data-structures/graph/diagrams/adjacency-list-pros-cons.jpg +0 -0
- package/src/data-structures/graph/diagrams/adjacency-list.jpg +0 -0
- package/src/data-structures/graph/diagrams/adjacency-matrix-pros-cons.jpg +0 -0
- package/src/data-structures/graph/diagrams/adjacency-matrix.jpg +0 -0
- package/src/data-structures/graph/diagrams/dfs-can-do.jpg +0 -0
- package/src/data-structures/graph/diagrams/edge-list-pros-cons.jpg +0 -0
- package/src/data-structures/graph/diagrams/edge-list.jpg +0 -0
- package/src/data-structures/graph/diagrams/max-flow.jpg +0 -0
- package/src/data-structures/graph/diagrams/mst.jpg +0 -0
- package/src/data-structures/graph/diagrams/tarjan-articulation-point-bridge.png +0 -0
- package/src/data-structures/graph/diagrams/tarjan-complicate-simple.png +0 -0
- package/src/data-structures/graph/diagrams/tarjan-strongly-connected-component.png +0 -0
- package/src/data-structures/graph/diagrams/tarjan.mp4 +0 -0
- package/src/data-structures/graph/diagrams/tarjan.webp +0 -0
- package/src/data-structures/graph/directed-graph.ts +0 -429
- package/src/data-structures/graph/index.ts +0 -3
- package/src/data-structures/graph/undirected-graph.ts +0 -259
- package/src/data-structures/hash/coordinate-map.ts +0 -74
- package/src/data-structures/hash/coordinate-set.ts +0 -63
- package/src/data-structures/hash/hash-table.ts +0 -1
- package/src/data-structures/hash/index.ts +0 -6
- package/src/data-structures/hash/pair.ts +0 -1
- package/src/data-structures/hash/tree-map.ts +0 -1
- package/src/data-structures/hash/tree-set.ts +0 -1
- package/src/data-structures/heap/heap.ts +0 -162
- package/src/data-structures/heap/index.ts +0 -3
- package/src/data-structures/heap/max-heap.ts +0 -31
- package/src/data-structures/heap/min-heap.ts +0 -34
- package/src/data-structures/index.ts +0 -13
- package/src/data-structures/linked-list/doubly-linked-list.ts +0 -365
- package/src/data-structures/linked-list/index.ts +0 -2
- package/src/data-structures/linked-list/singly-linked-list.ts +0 -757
- package/src/data-structures/linked-list/skip-linked-list.ts +0 -1
- package/src/data-structures/matrix/index.ts +0 -4
- package/src/data-structures/matrix/matrix.ts +0 -27
- package/src/data-structures/matrix/matrix2d.ts +0 -208
- package/src/data-structures/matrix/navigator.ts +0 -122
- package/src/data-structures/matrix/vector2d.ts +0 -316
- package/src/data-structures/priority-queue/index.ts +0 -3
- package/src/data-structures/priority-queue/max-priority-queue.ts +0 -24
- package/src/data-structures/priority-queue/min-priority-queue.ts +0 -24
- package/src/data-structures/priority-queue/priority-queue.ts +0 -349
- package/src/data-structures/queue/deque.ts +0 -251
- package/src/data-structures/queue/index.ts +0 -2
- package/src/data-structures/queue/queue.ts +0 -120
- package/src/data-structures/stack/index.ts +0 -1
- package/src/data-structures/stack/stack.ts +0 -98
- package/src/data-structures/trie/index.ts +0 -1
- package/src/data-structures/trie/trie.ts +0 -225
- package/src/data-structures/types/abstract-graph.ts +0 -51
- package/src/data-structures/types/avl-tree.ts +0 -6
- package/src/data-structures/types/binary-tree.ts +0 -15
- package/src/data-structures/types/bst.ts +0 -5
- package/src/data-structures/types/directed-graph.ts +0 -18
- package/src/data-structures/types/doubly-linked-list.ts +0 -1
- package/src/data-structures/types/heap.ts +0 -8
- package/src/data-structures/types/index.ts +0 -13
- package/src/data-structures/types/navigator.ts +0 -13
- package/src/data-structures/types/priority-queue.ts +0 -9
- package/src/data-structures/types/segment-tree.ts +0 -1
- package/src/data-structures/types/singly-linked-list.ts +0 -1
- package/src/data-structures/types/tree-multiset.ts +0 -3
- package/src/index.ts +0 -1
- package/src/utils/index.ts +0 -2
- package/src/utils/types/index.ts +0 -1
- package/src/utils/types/utils.ts +0 -4
- package/src/utils/utils.ts +0 -78
- package/tests/unit/data-structures/graph/abstract-graph.ts +0 -0
- package/tests/unit/data-structures/graph/directed-graph.test.ts +0 -492
- package/tests/unit/data-structures/graph/index.ts +0 -3
- package/tests/unit/data-structures/graph/undirected-graph.ts +0 -0
package/README.md
CHANGED
|
@@ -15,6 +15,12 @@ Hash, Coordinate Set, Coordinate Map, Heap, Priority Queue, Max Priority Queue,
|
|
|
15
15
|
|
|
16
16
|
# How
|
|
17
17
|
|
|
18
|
+
[API Docs](https://data-structure-typed-docs.vercel.app)
|
|
19
|
+
|
|
20
|
+
[Live Examples](https://data-structure-typed-examples.vercel.app)
|
|
21
|
+
|
|
22
|
+
<a href="https://data-structure-typed-examples.vercel.app" target="_blank">Live Examples</a>
|
|
23
|
+
|
|
18
24
|
## install
|
|
19
25
|
|
|
20
26
|
### yarn
|
|
@@ -130,12 +136,6 @@ npm install data-structure-typed
|
|
|
130
136
|
expect(bfsNodes[2].id).toBe(16);
|
|
131
137
|
```
|
|
132
138
|
|
|
133
|
-
## Live Examples
|
|
134
|
-
|
|
135
|
-
[//]: # ([Live Examples](https://data-structure-typed-examples.vercel.app))
|
|
136
|
-
|
|
137
|
-
<a href="https://data-structure-typed-examples.vercel.app" target="_blank">Live Examples</a>
|
|
138
|
-
|
|
139
139
|
### Directed Graph simple snippet
|
|
140
140
|
|
|
141
141
|
```typescript
|
|
@@ -733,41 +733,41 @@ describe('DirectedGraph Test3', () => {
|
|
|
733
733
|
</tbody>
|
|
734
734
|
</table>
|
|
735
735
|
|
|
736
|
-

|
|
737
737
|
|
|
738
|
-

|
|
739
739
|
|
|
740
|
-

|
|
741
741
|
|
|
742
|
-

|
|
743
743
|
|
|
744
|
-

|
|
745
745
|
|
|
746
|
-

|
|
747
747
|
|
|
748
|
-

|
|
749
749
|
|
|
750
|
-

|
|
751
751
|
|
|
752
|
-

|
|
753
753
|
|
|
754
|
-

|
|
755
755
|
|
|
756
|
-

|
|
757
757
|
|
|
758
|
-

|
|
759
759
|
|
|
760
|
-

|
|
761
761
|
|
|
762
|
-

|
|
763
763
|
|
|
764
|
-

|
|
765
765
|
|
|
766
|
-
[//]: # ()
|
|
767
767
|
|
|
768
|
-
[//]: # ()
|
|
769
769
|
|
|
770
|
-
[//]: # ()
|
|
771
771
|
|
|
772
772
|
|
|
773
773
|
|
|
@@ -6,8 +6,17 @@
|
|
|
6
6
|
* @license MIT License
|
|
7
7
|
*/
|
|
8
8
|
import { PriorityQueue } from '../priority-queue';
|
|
9
|
-
import type {
|
|
10
|
-
export declare
|
|
9
|
+
import type { HeapOptions } from '../types';
|
|
10
|
+
export declare class HeapItem<T = number> {
|
|
11
|
+
constructor(priority?: number, val?: T | null);
|
|
12
|
+
private _priority;
|
|
13
|
+
get priority(): number;
|
|
14
|
+
set priority(value: number);
|
|
15
|
+
private _val;
|
|
16
|
+
get val(): T | null;
|
|
17
|
+
set val(value: T | null);
|
|
18
|
+
}
|
|
19
|
+
export declare abstract class Heap<T = number> {
|
|
11
20
|
/**
|
|
12
21
|
* The function is a constructor for a class that initializes a priority callback function based on the
|
|
13
22
|
* options provided.
|
|
@@ -17,9 +26,9 @@ export declare abstract class Heap<T> {
|
|
|
17
26
|
protected abstract _pq: PriorityQueue<HeapItem<T>>;
|
|
18
27
|
get pq(): PriorityQueue<HeapItem<T>>;
|
|
19
28
|
protected set pq(v: PriorityQueue<HeapItem<T>>);
|
|
20
|
-
protected _priorityCb: (
|
|
21
|
-
get priorityCb(): (
|
|
22
|
-
protected set priorityCb(v: (
|
|
29
|
+
protected _priorityCb: (val: T) => number;
|
|
30
|
+
get priorityCb(): (val: T) => number;
|
|
31
|
+
protected set priorityCb(v: (val: T) => number);
|
|
23
32
|
/**
|
|
24
33
|
* The function returns the size of a priority queue.
|
|
25
34
|
* @returns The size of the priority queue.
|
|
@@ -32,7 +41,7 @@ export declare abstract class Heap<T> {
|
|
|
32
41
|
/**
|
|
33
42
|
* Starting from TypeScript version 5.0 and onwards, the use of distinct access modifiers for Getters and Setters is not permitted. As an alternative, to ensure compatibility, it is necessary to adopt a Java-style approach for Setters (using the same name as the property) while utilizing separate method names for Getters.
|
|
34
43
|
*/
|
|
35
|
-
getPriorityCb(): (
|
|
44
|
+
getPriorityCb(): (val: T) => number;
|
|
36
45
|
/**
|
|
37
46
|
* Starting from TypeScript version 5.0 and onwards, the use of distinct access modifiers for Getters and Setters is not permitted. As an alternative, to ensure compatibility, it is necessary to adopt a Java-style approach for Setters (using the same name as the property) while utilizing separate method names for Getters.
|
|
38
47
|
*/
|
|
@@ -44,33 +53,39 @@ export declare abstract class Heap<T> {
|
|
|
44
53
|
isEmpty(): boolean;
|
|
45
54
|
/**
|
|
46
55
|
* The `peek` function returns the top item in the priority queue without removing it.
|
|
47
|
-
* @returns The `peek()` method is returning either a `HeapItem<T>` object or `null`.Returns an
|
|
56
|
+
* @returns The `peek()` method is returning either a `HeapItem<T>` object or `null`.Returns an val with the highest priority in the queue
|
|
48
57
|
*/
|
|
49
58
|
peek(): HeapItem<T> | null;
|
|
50
59
|
/**
|
|
51
60
|
* The `peekLast` function returns the last item in the heap.
|
|
52
|
-
* @returns The method `peekLast()` returns either a `HeapItem<T>` object or `null`.Returns an
|
|
61
|
+
* @returns The method `peekLast()` returns either a `HeapItem<T>` object or `null`.Returns an val with the lowest priority in the queue
|
|
53
62
|
*/
|
|
54
63
|
peekLast(): HeapItem<T> | null;
|
|
55
64
|
/**
|
|
56
|
-
* The `add` function adds an
|
|
57
|
-
* @param {T}
|
|
65
|
+
* The `add` function adds an val to a priority queue with an optional priority value.
|
|
66
|
+
* @param {T} val - The `val` parameter represents the value that you want to add to the heap. It can be of any
|
|
58
67
|
* type.
|
|
59
68
|
* @param {number} [priority] - The `priority` parameter is an optional number that represents the priority of the
|
|
60
|
-
*
|
|
61
|
-
* the value of `
|
|
69
|
+
* val being added to the heap. If the `val` parameter is a number, then the `priority` parameter is set to
|
|
70
|
+
* the value of `val`. If the `val` parameter is not a number, then the
|
|
62
71
|
* @returns The `add` method returns the instance of the `Heap` class.
|
|
63
72
|
* @throws {Error} if priority is not a valid number
|
|
64
73
|
*/
|
|
65
|
-
add(
|
|
74
|
+
add(val: T, priority?: number): Heap<T>;
|
|
66
75
|
/**
|
|
67
|
-
* The `poll` function returns the top item from a priority queue or null if the queue is empty.Removes and returns an
|
|
76
|
+
* The `poll` function returns the top item from a priority queue or null if the queue is empty.Removes and returns an val with the highest priority in the queue
|
|
68
77
|
* @returns either a HeapItem<T> object or null.
|
|
69
78
|
*/
|
|
70
79
|
poll(): HeapItem<T> | null;
|
|
80
|
+
/**
|
|
81
|
+
* The function checks if a given node or value exists in the priority queue.
|
|
82
|
+
* @param {T | HeapItem<T>} node - The parameter `node` can be of type `T` or `HeapItem<T>`.
|
|
83
|
+
* @returns a boolean value.
|
|
84
|
+
*/
|
|
85
|
+
has(node: T | HeapItem<T>): boolean;
|
|
71
86
|
/**
|
|
72
87
|
* The `toArray` function returns an array of `HeapItem<T>` objects.
|
|
73
|
-
* @returns An array of HeapItem<T> objects.Returns a sorted list of
|
|
88
|
+
* @returns An array of HeapItem<T> objects.Returns a sorted list of vals
|
|
74
89
|
*/
|
|
75
90
|
toArray(): HeapItem<T>[];
|
|
76
91
|
/**
|
|
@@ -1,6 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Heap = void 0;
|
|
3
|
+
exports.Heap = exports.HeapItem = void 0;
|
|
4
|
+
var HeapItem = /** @class */ (function () {
|
|
5
|
+
function HeapItem(priority, val) {
|
|
6
|
+
if (priority === void 0) { priority = NaN; }
|
|
7
|
+
if (val === void 0) { val = null; }
|
|
8
|
+
this._val = val;
|
|
9
|
+
this._priority = priority;
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(HeapItem.prototype, "priority", {
|
|
12
|
+
get: function () {
|
|
13
|
+
return this._priority;
|
|
14
|
+
},
|
|
15
|
+
set: function (value) {
|
|
16
|
+
this._priority = value;
|
|
17
|
+
},
|
|
18
|
+
enumerable: false,
|
|
19
|
+
configurable: true
|
|
20
|
+
});
|
|
21
|
+
Object.defineProperty(HeapItem.prototype, "val", {
|
|
22
|
+
get: function () {
|
|
23
|
+
return this._val;
|
|
24
|
+
},
|
|
25
|
+
set: function (value) {
|
|
26
|
+
this._val = value;
|
|
27
|
+
},
|
|
28
|
+
enumerable: false,
|
|
29
|
+
configurable: true
|
|
30
|
+
});
|
|
31
|
+
return HeapItem;
|
|
32
|
+
}());
|
|
33
|
+
exports.HeapItem = HeapItem;
|
|
4
34
|
var Heap = /** @class */ (function () {
|
|
5
35
|
/**
|
|
6
36
|
* The function is a constructor for a class that initializes a priority callback function based on the
|
|
@@ -77,31 +107,31 @@ var Heap = /** @class */ (function () {
|
|
|
77
107
|
};
|
|
78
108
|
/**
|
|
79
109
|
* The `peek` function returns the top item in the priority queue without removing it.
|
|
80
|
-
* @returns The `peek()` method is returning either a `HeapItem<T>` object or `null`.Returns an
|
|
110
|
+
* @returns The `peek()` method is returning either a `HeapItem<T>` object or `null`.Returns an val with the highest priority in the queue
|
|
81
111
|
*/
|
|
82
112
|
Heap.prototype.peek = function () {
|
|
83
113
|
return this._pq.peek();
|
|
84
114
|
};
|
|
85
115
|
/**
|
|
86
116
|
* The `peekLast` function returns the last item in the heap.
|
|
87
|
-
* @returns The method `peekLast()` returns either a `HeapItem<T>` object or `null`.Returns an
|
|
117
|
+
* @returns The method `peekLast()` returns either a `HeapItem<T>` object or `null`.Returns an val with the lowest priority in the queue
|
|
88
118
|
*/
|
|
89
119
|
Heap.prototype.peekLast = function () {
|
|
90
120
|
return this._pq.leaf();
|
|
91
121
|
};
|
|
92
122
|
/**
|
|
93
|
-
* The `add` function adds an
|
|
94
|
-
* @param {T}
|
|
123
|
+
* The `add` function adds an val to a priority queue with an optional priority value.
|
|
124
|
+
* @param {T} val - The `val` parameter represents the value that you want to add to the heap. It can be of any
|
|
95
125
|
* type.
|
|
96
126
|
* @param {number} [priority] - The `priority` parameter is an optional number that represents the priority of the
|
|
97
|
-
*
|
|
98
|
-
* the value of `
|
|
127
|
+
* val being added to the heap. If the `val` parameter is a number, then the `priority` parameter is set to
|
|
128
|
+
* the value of `val`. If the `val` parameter is not a number, then the
|
|
99
129
|
* @returns The `add` method returns the instance of the `Heap` class.
|
|
100
130
|
* @throws {Error} if priority is not a valid number
|
|
101
131
|
*/
|
|
102
|
-
Heap.prototype.add = function (
|
|
103
|
-
if (typeof
|
|
104
|
-
priority =
|
|
132
|
+
Heap.prototype.add = function (val, priority) {
|
|
133
|
+
if (typeof val === 'number') {
|
|
134
|
+
priority = val;
|
|
105
135
|
}
|
|
106
136
|
else {
|
|
107
137
|
if (priority === undefined) {
|
|
@@ -111,16 +141,16 @@ var Heap = /** @class */ (function () {
|
|
|
111
141
|
if (priority && Number.isNaN(+priority)) {
|
|
112
142
|
throw new Error('.add expects a numeric priority');
|
|
113
143
|
}
|
|
114
|
-
if (Number.isNaN(+priority) && Number.isNaN(this._priorityCb(
|
|
144
|
+
if (Number.isNaN(+priority) && Number.isNaN(this._priorityCb(val))) {
|
|
115
145
|
throw new Error('.add expects a numeric priority '
|
|
116
146
|
+ 'or a constructor callback that returns a number');
|
|
117
147
|
}
|
|
118
|
-
var _priority = !Number.isNaN(+priority) ? priority : this._priorityCb(
|
|
119
|
-
this._pq.add(
|
|
148
|
+
var _priority = !Number.isNaN(+priority) ? priority : this._priorityCb(val);
|
|
149
|
+
this._pq.add(new HeapItem(_priority, val));
|
|
120
150
|
return this;
|
|
121
151
|
};
|
|
122
152
|
/**
|
|
123
|
-
* The `poll` function returns the top item from a priority queue or null if the queue is empty.Removes and returns an
|
|
153
|
+
* The `poll` function returns the top item from a priority queue or null if the queue is empty.Removes and returns an val with the highest priority in the queue
|
|
124
154
|
* @returns either a HeapItem<T> object or null.
|
|
125
155
|
*/
|
|
126
156
|
Heap.prototype.poll = function () {
|
|
@@ -130,9 +160,24 @@ var Heap = /** @class */ (function () {
|
|
|
130
160
|
}
|
|
131
161
|
return top;
|
|
132
162
|
};
|
|
163
|
+
/**
|
|
164
|
+
* The function checks if a given node or value exists in the priority queue.
|
|
165
|
+
* @param {T | HeapItem<T>} node - The parameter `node` can be of type `T` or `HeapItem<T>`.
|
|
166
|
+
* @returns a boolean value.
|
|
167
|
+
*/
|
|
168
|
+
Heap.prototype.has = function (node) {
|
|
169
|
+
if (node instanceof (HeapItem)) {
|
|
170
|
+
return this.getPq().getNodes().includes(node);
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
return this.getPq().getNodes().findIndex(function (item) {
|
|
174
|
+
return item.val === node;
|
|
175
|
+
}) !== -1;
|
|
176
|
+
}
|
|
177
|
+
};
|
|
133
178
|
/**
|
|
134
179
|
* The `toArray` function returns an array of `HeapItem<T>` objects.
|
|
135
|
-
* @returns An array of HeapItem<T> objects.Returns a sorted list of
|
|
180
|
+
* @returns An array of HeapItem<T> objects.Returns a sorted list of vals
|
|
136
181
|
*/
|
|
137
182
|
Heap.prototype.toArray = function () {
|
|
138
183
|
return this._pq.toArray();
|
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
* @copyright Copyright (c) 2022 Tyler Zeng <zrwusa@gmail.com>
|
|
6
6
|
* @license MIT License
|
|
7
7
|
*/
|
|
8
|
-
import { Heap } from './heap';
|
|
8
|
+
import { Heap, HeapItem } from './heap';
|
|
9
9
|
import { PriorityQueue } from '../priority-queue';
|
|
10
|
-
import type {
|
|
10
|
+
import type { HeapOptions } from '../types';
|
|
11
11
|
/**
|
|
12
12
|
* @class MaxHeap
|
|
13
13
|
* @extends Heap
|
|
14
14
|
*/
|
|
15
|
-
export declare class MaxHeap<T> extends Heap<T> {
|
|
15
|
+
export declare class MaxHeap<T = number> extends Heap<T> {
|
|
16
16
|
protected _pq: PriorityQueue<HeapItem<T>>;
|
|
17
17
|
/**
|
|
18
18
|
* The constructor initializes a PriorityQueue with a custom comparator function.
|
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
* @copyright Copyright (c) 2022 Tyler Zeng <zrwusa@gmail.com>
|
|
6
6
|
* @license MIT License
|
|
7
7
|
*/
|
|
8
|
-
import { Heap } from './heap';
|
|
8
|
+
import { Heap, HeapItem } from './heap';
|
|
9
9
|
import { PriorityQueue } from '../priority-queue';
|
|
10
|
-
import type {
|
|
10
|
+
import type { HeapOptions } from '../types';
|
|
11
11
|
/**
|
|
12
12
|
* @class MinHeap
|
|
13
13
|
* @extends Heap
|
|
14
14
|
*/
|
|
15
|
-
export declare class MinHeap<T> extends Heap<T> {
|
|
15
|
+
export declare class MinHeap<T = number> extends Heap<T> {
|
|
16
16
|
protected _pq: PriorityQueue<HeapItem<T>>;
|
|
17
17
|
/**
|
|
18
18
|
* The constructor initializes a PriorityQueue with a comparator function that compares the priority of two HeapItem
|
|
@@ -20,6 +20,7 @@ __exportStar(require("./stack"), exports);
|
|
|
20
20
|
__exportStar(require("./queue"), exports);
|
|
21
21
|
__exportStar(require("./graph"), exports);
|
|
22
22
|
__exportStar(require("./binary-tree"), exports);
|
|
23
|
+
__exportStar(require("./tree"), exports);
|
|
23
24
|
__exportStar(require("./heap"), exports);
|
|
24
25
|
__exportStar(require("./priority-queue"), exports);
|
|
25
26
|
__exportStar(require("./matrix"), exports);
|
|
@@ -1,89 +1,216 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* data-structure-typed
|
|
3
|
+
*
|
|
4
|
+
* @author Tyler Zeng
|
|
5
|
+
* @copyright Copyright (c) 2022 Tyler Zeng <zrwusa@gmail.com>
|
|
6
|
+
* @license MIT License
|
|
7
|
+
*/
|
|
8
|
+
export declare class DoublyLinkedListNode<T = number> {
|
|
9
|
+
/**
|
|
10
|
+
* The constructor function initializes the value, next, and previous properties of an object.
|
|
11
|
+
* @param {T} val - The "val" parameter is the value that will be stored in the node. It can be of any data type, as it
|
|
12
|
+
* is defined as a generic type "T".
|
|
13
|
+
*/
|
|
14
|
+
constructor(val: T);
|
|
15
|
+
private _val;
|
|
4
16
|
get val(): T;
|
|
5
|
-
set val(
|
|
6
|
-
|
|
17
|
+
set val(value: T);
|
|
18
|
+
private _next;
|
|
7
19
|
get next(): DoublyLinkedListNode<T> | null;
|
|
8
|
-
set next(
|
|
9
|
-
|
|
20
|
+
set next(value: DoublyLinkedListNode<T> | null);
|
|
21
|
+
private _prev;
|
|
10
22
|
get prev(): DoublyLinkedListNode<T> | null;
|
|
11
|
-
set prev(
|
|
23
|
+
set prev(value: DoublyLinkedListNode<T> | null);
|
|
12
24
|
}
|
|
13
25
|
export declare class DoublyLinkedList<T> {
|
|
26
|
+
/**
|
|
27
|
+
* The constructor initializes the linked list with an empty head, tail, and length.
|
|
28
|
+
*/
|
|
14
29
|
constructor();
|
|
15
|
-
|
|
16
|
-
get
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
get
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
get
|
|
23
|
-
protected set
|
|
30
|
+
private _head;
|
|
31
|
+
get head(): DoublyLinkedListNode<T> | null;
|
|
32
|
+
set head(value: DoublyLinkedListNode<T> | null);
|
|
33
|
+
private _tail;
|
|
34
|
+
get tail(): DoublyLinkedListNode<T> | null;
|
|
35
|
+
set tail(value: DoublyLinkedListNode<T> | null);
|
|
36
|
+
private _length;
|
|
37
|
+
get length(): number;
|
|
38
|
+
protected set length(value: number);
|
|
24
39
|
/**
|
|
25
|
-
*
|
|
40
|
+
* The `fromArray` function creates a new instance of a DoublyLinkedList and populates it with the elements from the
|
|
41
|
+
* given array.
|
|
42
|
+
* @param {T[]} data - The `data` parameter is an array of elements of type `T`.
|
|
43
|
+
* @returns The `fromArray` function returns a DoublyLinkedList object.
|
|
26
44
|
*/
|
|
27
|
-
|
|
45
|
+
static fromArray<T>(data: T[]): DoublyLinkedList<T>;
|
|
46
|
+
getLength(): number;
|
|
28
47
|
/**
|
|
29
|
-
*
|
|
48
|
+
* The push function adds a new node with the given value to the end of the doubly linked list.
|
|
49
|
+
* @param {T} val - The value to be added to the linked list.
|
|
30
50
|
*/
|
|
31
|
-
|
|
51
|
+
push(val: T): void;
|
|
32
52
|
/**
|
|
33
|
-
*
|
|
53
|
+
* The `pop()` function removes and returns the value of the last node in a doubly linked list.
|
|
54
|
+
* @returns The method is returning the value of the removed node (removedNode.val) if the list is not empty. If the
|
|
55
|
+
* list is empty, it returns null.
|
|
34
56
|
*/
|
|
35
|
-
|
|
57
|
+
pop(): T | null;
|
|
36
58
|
/**
|
|
37
|
-
* The function
|
|
38
|
-
* @
|
|
39
|
-
*
|
|
40
|
-
* @returns A boolean value is being returned.
|
|
59
|
+
* The `shift()` function removes and returns the value of the first node in a doubly linked list.
|
|
60
|
+
* @returns The method `shift()` returns the value of the node that is removed from the beginning of the doubly linked
|
|
61
|
+
* list.
|
|
41
62
|
*/
|
|
42
|
-
|
|
63
|
+
shift(): T | null;
|
|
43
64
|
/**
|
|
44
|
-
* The function adds a new node with
|
|
45
|
-
* @param {T} val - The `val` parameter represents the value of the
|
|
65
|
+
* The unshift function adds a new node with the given value to the beginning of a doubly linked list.
|
|
66
|
+
* @param {T} val - The `val` parameter represents the value of the new node that will be added to the beginning of the
|
|
46
67
|
* doubly linked list.
|
|
47
|
-
* @returns a boolean value, which is always true.
|
|
48
|
-
*/
|
|
49
|
-
addLast(val: T): boolean;
|
|
50
|
-
peekFirst(): T | null;
|
|
51
|
-
peekFirst(by: 'val'): T | null;
|
|
52
|
-
peekFirst(by: 'node'): DoublyLinkedListNode<T> | null;
|
|
53
|
-
peekLast(): T | null;
|
|
54
|
-
peekLast(by: 'val'): T | null;
|
|
55
|
-
peekLast(by: 'node'): DoublyLinkedListNode<T> | null;
|
|
56
|
-
pollFirst(): T | null;
|
|
57
|
-
pollFirst(by: 'val'): T | null;
|
|
58
|
-
pollFirst(by: 'node'): DoublyLinkedListNode<T> | null;
|
|
59
|
-
pollLast(): T | null;
|
|
60
|
-
pollLast(by: 'val'): T | null;
|
|
61
|
-
pollLast(by: 'node'): DoublyLinkedListNode<T> | null;
|
|
62
|
-
get(index: number): T | null;
|
|
63
|
-
get(index: number, by: 'node'): DoublyLinkedListNode<T> | null;
|
|
64
|
-
get(index: number, by: 'val'): T | null;
|
|
65
|
-
/**
|
|
66
|
-
* Updates the value of the node at the specified index.
|
|
67
|
-
* If index = 0; Value of the first element in the list is updated.
|
|
68
|
-
* If index = 3; Value of the fourth element in the list is updated.
|
|
69
|
-
* @param index Index of the node to be updated
|
|
70
|
-
* @param val New value of the node
|
|
71
|
-
*/
|
|
72
|
-
set(index: number, val: T): boolean;
|
|
73
|
-
isEmpty(): boolean;
|
|
74
|
-
/**
|
|
75
|
-
* Inserts a new node at the specified index.
|
|
76
|
-
* @param index Index at which the new node has to be inserted
|
|
77
|
-
* @param val Value of the new node to be inserted
|
|
78
68
|
*/
|
|
79
|
-
|
|
69
|
+
unshift(val: T): void;
|
|
70
|
+
/**
|
|
71
|
+
* The `getAt` function returns the value at a specified index in a linked list, or null if the index is out of bounds.
|
|
72
|
+
* @param {number} index - The index parameter is a number that represents the position of the element we want to
|
|
73
|
+
* retrieve from the list.
|
|
74
|
+
* @returns The method is returning the value at the specified index in the linked list. If the index is out of bounds
|
|
75
|
+
* or the linked list is empty, it will return null.
|
|
76
|
+
*/
|
|
77
|
+
getAt(index: number): T | null;
|
|
78
|
+
/**
|
|
79
|
+
* The function `getNodeAt` returns the node at a given index in a doubly linked list, or null if the index is out of
|
|
80
|
+
* range.
|
|
81
|
+
* @param {number} index - The `index` parameter is a number that represents the position of the node we want to
|
|
82
|
+
* retrieve from the doubly linked list. It indicates the zero-based index of the node we want to access.
|
|
83
|
+
* @returns The method `getNodeAt(index: number)` returns a `DoublyLinkedListNode<T>` object if the index is within the
|
|
84
|
+
* valid range of the linked list, otherwise it returns `null`.
|
|
85
|
+
*/
|
|
86
|
+
getNodeAt(index: number): DoublyLinkedListNode<T> | null;
|
|
87
|
+
/**
|
|
88
|
+
* The function `findNodeByValue` searches for a node with a specific value in a doubly linked list and returns the
|
|
89
|
+
* node if found, otherwise it returns null.
|
|
90
|
+
* @param {T} val - The `val` parameter is the value that we want to search for in the doubly linked list.
|
|
91
|
+
* @returns The function `findNodeByValue` returns a `DoublyLinkedListNode<T>` if a node with the specified value `val`
|
|
92
|
+
* is found in the linked list. If no such node is found, it returns `null`.
|
|
93
|
+
*/
|
|
94
|
+
findNode(val: T): DoublyLinkedListNode<T> | null;
|
|
80
95
|
/**
|
|
81
|
-
* The `
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
96
|
+
* The `insert` function inserts a value at a specified index in a doubly linked list.
|
|
97
|
+
* @param {number} index - The index parameter represents the position at which the new value should be inserted in the
|
|
98
|
+
* DoublyLinkedList. It is of type number.
|
|
99
|
+
* @param {T} val - The `val` parameter represents the value that you want to insert into the Doubly Linked List at the
|
|
100
|
+
* specified index.
|
|
101
|
+
* @returns The `insert` method returns a boolean value. It returns `true` if the insertion is successful, and `false`
|
|
86
102
|
* if the index is out of bounds.
|
|
87
103
|
*/
|
|
88
|
-
|
|
104
|
+
insert(index: number, val: T): boolean;
|
|
105
|
+
/**
|
|
106
|
+
* The `deleteAt` function removes an element at a specified index from a linked list and returns the removed element.
|
|
107
|
+
* @param {number} index - The index parameter represents the position of the element that needs to be deleted in the
|
|
108
|
+
* data structure. It is of type number.
|
|
109
|
+
* @returns The method `deleteAt` returns the value of the node that was deleted, or `null` if the index is out of
|
|
110
|
+
* bounds.
|
|
111
|
+
*/
|
|
112
|
+
deleteAt(index: number): T | null;
|
|
113
|
+
/**
|
|
114
|
+
* The `delete` function removes a node with a specific value from a doubly linked list.
|
|
115
|
+
* @param {T} val - The `val` parameter represents the value that you want to delete from the linked list.
|
|
116
|
+
* @returns The `delete` method returns a boolean value. It returns `true` if the value `val` is found and deleted from
|
|
117
|
+
* the linked list, and `false` if the value is not found in the linked list.
|
|
118
|
+
*/
|
|
119
|
+
delete(val: T): boolean;
|
|
120
|
+
/**
|
|
121
|
+
* The `toArray` function converts a linked list into an array.
|
|
122
|
+
* @returns The `toArray()` method is returning an array of type `T[]`.
|
|
123
|
+
*/
|
|
124
|
+
toArray(): T[];
|
|
125
|
+
/**
|
|
126
|
+
* The `clear` function resets the linked list by setting the head, tail, and length to null and 0 respectively.
|
|
127
|
+
*/
|
|
128
|
+
clear(): void;
|
|
129
|
+
/**
|
|
130
|
+
* The `find` function iterates through a linked list and returns the first element that satisfies a given condition.
|
|
131
|
+
* @param callback - A function that takes a value of type T as its parameter and returns a boolean value. This
|
|
132
|
+
* function is used to determine whether a particular value in the linked list satisfies a certain condition.
|
|
133
|
+
* @returns The method `find` returns the first element in the linked list that satisfies the condition specified by
|
|
134
|
+
* the callback function. If no element satisfies the condition, it returns `null`.
|
|
135
|
+
*/
|
|
136
|
+
find(callback: (val: T) => boolean): T | null;
|
|
137
|
+
/**
|
|
138
|
+
* The function returns the index of the first occurrence of a given value in a linked list.
|
|
139
|
+
* @param {T} val - The parameter `val` is of type `T`, which means it can be any data type. It represents the value
|
|
140
|
+
* that we are searching for in the linked list.
|
|
141
|
+
* @returns The method `indexOf` returns the index of the first occurrence of the specified value `val` in the linked
|
|
142
|
+
* list. If the value is not found, it returns -1.
|
|
143
|
+
*/
|
|
144
|
+
indexOf(val: T): number;
|
|
145
|
+
/**
|
|
146
|
+
* The `findLast` function iterates through a linked list from the last node to the first node and returns the last
|
|
147
|
+
* value that satisfies the given callback function, or null if no value satisfies the callback.
|
|
148
|
+
* @param callback - A function that takes a value of type T as its parameter and returns a boolean value. This
|
|
149
|
+
* function is used to determine whether a given value satisfies a certain condition.
|
|
150
|
+
* @returns The method `findLast` returns the last value in the linked list that satisfies the condition specified by
|
|
151
|
+
* the callback function. If no value satisfies the condition, it returns `null`.
|
|
152
|
+
*/
|
|
153
|
+
findLast(callback: (val: T) => boolean): T | null;
|
|
154
|
+
/**
|
|
155
|
+
* The `toArrayReverse` function converts a doubly linked list into an array in reverse order.
|
|
156
|
+
* @returns The `toArrayReverse()` function returns an array of type `T[]`.
|
|
157
|
+
*/
|
|
158
|
+
toArrayReverse(): T[];
|
|
159
|
+
/**
|
|
160
|
+
* The `reverse` function reverses the order of the elements in a doubly linked list.
|
|
161
|
+
*/
|
|
162
|
+
reverse(): void;
|
|
163
|
+
/**
|
|
164
|
+
* The `forEach` function iterates over each element in a linked list and applies a callback function to each element.
|
|
165
|
+
* @param callback - The callback parameter is a function that takes two arguments: val and index. The val argument
|
|
166
|
+
* represents the value of the current node in the linked list, and the index argument represents the index of the
|
|
167
|
+
* current node in the linked list.
|
|
168
|
+
*/
|
|
169
|
+
forEach(callback: (val: T, index: number) => void): void;
|
|
170
|
+
/**
|
|
171
|
+
* The `map` function takes a callback function and applies it to each element in the DoublyLinkedList, returning a new
|
|
172
|
+
* DoublyLinkedList with the transformed values.
|
|
173
|
+
* @param callback - The callback parameter is a function that takes a value of type T (the type of values stored in
|
|
174
|
+
* the original DoublyLinkedList) and returns a value of type U (the type of values that will be stored in the mapped
|
|
175
|
+
* DoublyLinkedList).
|
|
176
|
+
* @returns The `map` function is returning a new instance of `DoublyLinkedList<U>` that contains the mapped values.
|
|
177
|
+
*/
|
|
178
|
+
map<U>(callback: (val: T) => U): DoublyLinkedList<U>;
|
|
179
|
+
/**
|
|
180
|
+
* The `filter` function iterates through a DoublyLinkedList and returns a new DoublyLinkedList containing only the
|
|
181
|
+
* elements that satisfy the given callback function.
|
|
182
|
+
* @param callback - The `callback` parameter is a function that takes a value of type `T` and returns a boolean value.
|
|
183
|
+
* It is used to determine whether a value should be included in the filtered list or not.
|
|
184
|
+
* @returns The filtered list, which is an instance of the DoublyLinkedList class.
|
|
185
|
+
*/
|
|
186
|
+
filter(callback: (val: T) => boolean): DoublyLinkedList<T>;
|
|
187
|
+
/**
|
|
188
|
+
* The `reduce` function iterates over a linked list and applies a callback function to each element, accumulating a
|
|
189
|
+
* single value.
|
|
190
|
+
* @param callback - The `callback` parameter is a function that takes two arguments: `accumulator` and `val`. It is
|
|
191
|
+
* used to perform a specific operation on each element of the linked list.
|
|
192
|
+
* @param {U} initialValue - The `initialValue` parameter is the initial value of the accumulator. It is the starting
|
|
193
|
+
* point for the reduction operation.
|
|
194
|
+
* @returns The `reduce` method is returning the final value of the accumulator after iterating through all the
|
|
195
|
+
* elements in the linked list.
|
|
196
|
+
*/
|
|
197
|
+
reduce<U>(callback: (accumulator: U, val: T) => U, initialValue: U): U;
|
|
198
|
+
/**
|
|
199
|
+
* The function inserts a new value after an existing value in a doubly linked list.
|
|
200
|
+
* @param {T} existingValue - The existing value is the value of the node after which we want to insert the new value.
|
|
201
|
+
* @param {T} newValue - The `newValue` parameter represents the value of the new node that you want to insert after
|
|
202
|
+
* the existing node.
|
|
203
|
+
* @returns The method is returning a boolean value. It returns true if the insertion is successful and false if the
|
|
204
|
+
* existing value is not found in the linked list.
|
|
205
|
+
*/
|
|
206
|
+
insertAfter(existingValue: T, newValue: T): boolean;
|
|
207
|
+
/**
|
|
208
|
+
* The `insertBefore` function inserts a new value before an existing value in a doubly linked list.
|
|
209
|
+
* @param {T} existingValue - The existing value is the value of the node that you want to insert the new value before.
|
|
210
|
+
* @param {T} newValue - The `newValue` parameter represents the value of the new node that you want to insert before
|
|
211
|
+
* the existing node.
|
|
212
|
+
* @returns The method is returning a boolean value. It returns true if the insertion is successful and false if the
|
|
213
|
+
* existing value is not found in the linked list.
|
|
214
|
+
*/
|
|
215
|
+
insertBefore(existingValue: T, newValue: T): boolean;
|
|
89
216
|
}
|