data-structure-typed 1.34.7 → 1.34.9
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/.eslintrc.js +1 -0
- package/CHANGELOG.md +1 -1
- package/CONTRIBUTING.md +0 -0
- package/README.md +8 -8
- package/dist/data-structures/binary-tree/aa-tree.js +2 -5
- package/dist/data-structures/binary-tree/aa-tree.js.map +1 -1
- package/dist/data-structures/binary-tree/abstract-binary-tree.js +314 -457
- package/dist/data-structures/binary-tree/abstract-binary-tree.js.map +1 -1
- package/dist/data-structures/binary-tree/avl-tree.js +64 -90
- package/dist/data-structures/binary-tree/avl-tree.js.map +1 -1
- package/dist/data-structures/binary-tree/b-tree.js +2 -5
- package/dist/data-structures/binary-tree/b-tree.js.map +1 -1
- package/dist/data-structures/binary-tree/binary-indexed-tree.js +17 -22
- package/dist/data-structures/binary-tree/binary-indexed-tree.js.map +1 -1
- package/dist/data-structures/binary-tree/binary-tree.js +12 -31
- package/dist/data-structures/binary-tree/binary-tree.js.map +1 -1
- package/dist/data-structures/binary-tree/bst.js +157 -244
- package/dist/data-structures/binary-tree/bst.js.map +1 -1
- package/dist/data-structures/binary-tree/rb-tree.js +20 -44
- package/dist/data-structures/binary-tree/rb-tree.js.map +1 -1
- package/dist/data-structures/binary-tree/segment-tree.js +80 -122
- package/dist/data-structures/binary-tree/segment-tree.js.map +1 -1
- package/dist/data-structures/binary-tree/splay-tree.js +2 -5
- package/dist/data-structures/binary-tree/splay-tree.js.map +1 -1
- package/dist/data-structures/binary-tree/tree-multiset.js +168 -239
- package/dist/data-structures/binary-tree/tree-multiset.js.map +1 -1
- package/dist/data-structures/binary-tree/two-three-tree.js +2 -5
- package/dist/data-structures/binary-tree/two-three-tree.js.map +1 -1
- package/dist/data-structures/graph/abstract-graph.js +351 -585
- package/dist/data-structures/graph/abstract-graph.js.map +1 -1
- package/dist/data-structures/graph/directed-graph.js +152 -282
- package/dist/data-structures/graph/directed-graph.js.map +1 -1
- package/dist/data-structures/graph/map-graph.js +47 -88
- package/dist/data-structures/graph/map-graph.js.map +1 -1
- package/dist/data-structures/graph/undirected-graph.js +91 -180
- package/dist/data-structures/graph/undirected-graph.js.map +1 -1
- package/dist/data-structures/hash/coordinate-map.js +23 -45
- package/dist/data-structures/hash/coordinate-map.js.map +1 -1
- package/dist/data-structures/hash/coordinate-set.js +20 -42
- package/dist/data-structures/hash/coordinate-set.js.map +1 -1
- package/dist/data-structures/hash/hash-map.js +85 -247
- package/dist/data-structures/hash/hash-map.js.map +1 -1
- package/dist/data-structures/hash/hash-table.js +87 -128
- package/dist/data-structures/hash/hash-table.js.map +1 -1
- package/dist/data-structures/hash/pair.js +2 -5
- package/dist/data-structures/hash/pair.js.map +1 -1
- package/dist/data-structures/hash/tree-map.js +2 -5
- package/dist/data-structures/hash/tree-map.js.map +1 -1
- package/dist/data-structures/hash/tree-set.js +2 -5
- package/dist/data-structures/hash/tree-set.js.map +1 -1
- package/dist/data-structures/heap/heap.js +56 -80
- package/dist/data-structures/heap/heap.js.map +1 -1
- package/dist/data-structures/heap/max-heap.js +8 -26
- package/dist/data-structures/heap/max-heap.js.map +1 -1
- package/dist/data-structures/heap/min-heap.js +8 -26
- package/dist/data-structures/heap/min-heap.js.map +1 -1
- package/dist/data-structures/linked-list/doubly-linked-list.js +149 -218
- package/dist/data-structures/linked-list/doubly-linked-list.js.map +1 -1
- package/dist/data-structures/linked-list/singly-linked-list.js +119 -218
- package/dist/data-structures/linked-list/singly-linked-list.js.map +1 -1
- package/dist/data-structures/linked-list/skip-linked-list.js +50 -70
- package/dist/data-structures/linked-list/skip-linked-list.js.map +1 -1
- package/dist/data-structures/matrix/matrix.js +7 -8
- package/dist/data-structures/matrix/matrix.js.map +1 -1
- package/dist/data-structures/matrix/matrix2d.js +57 -70
- package/dist/data-structures/matrix/matrix2d.js.map +1 -1
- package/dist/data-structures/matrix/navigator.js +18 -37
- package/dist/data-structures/matrix/navigator.js.map +1 -1
- package/dist/data-structures/matrix/vector2d.js +63 -84
- package/dist/data-structures/matrix/vector2d.js.map +1 -1
- package/dist/data-structures/priority-queue/max-priority-queue.js +13 -41
- package/dist/data-structures/priority-queue/max-priority-queue.js.map +1 -1
- package/dist/data-structures/priority-queue/min-priority-queue.js +13 -41
- package/dist/data-structures/priority-queue/min-priority-queue.js.map +1 -1
- package/dist/data-structures/priority-queue/priority-queue.js +93 -139
- package/dist/data-structures/priority-queue/priority-queue.js.map +1 -1
- package/dist/data-structures/queue/deque.js +82 -128
- package/dist/data-structures/queue/deque.js.map +1 -1
- package/dist/data-structures/queue/queue.js +57 -157
- package/dist/data-structures/queue/queue.js.map +1 -1
- package/dist/data-structures/stack/stack.js +21 -22
- package/dist/data-structures/stack/stack.js.map +1 -1
- package/dist/data-structures/tree/tree.js +33 -46
- package/dist/data-structures/tree/tree.js.map +1 -1
- package/dist/data-structures/trie/trie.js +93 -200
- package/dist/data-structures/trie/trie.js.map +1 -1
- package/dist/types/data-structures/abstract-binary-tree.js.map +1 -1
- package/dist/utils/utils.js +22 -107
- package/dist/utils/utils.js.map +1 -1
- package/lib/data-structures/binary-tree/abstract-binary-tree.d.ts +124 -123
- package/lib/data-structures/binary-tree/abstract-binary-tree.js +136 -216
- package/lib/data-structures/binary-tree/avl-tree.d.ts +19 -10
- package/lib/data-structures/binary-tree/avl-tree.js +35 -13
- package/lib/data-structures/binary-tree/binary-tree.d.ts +6 -6
- package/lib/data-structures/binary-tree/binary-tree.js +7 -7
- package/lib/data-structures/binary-tree/bst.d.ts +34 -34
- package/lib/data-structures/binary-tree/bst.js +86 -89
- package/lib/data-structures/binary-tree/rb-tree.d.ts +3 -3
- package/lib/data-structures/binary-tree/rb-tree.js +4 -4
- package/lib/data-structures/binary-tree/tree-multiset.d.ts +40 -42
- package/lib/data-structures/binary-tree/tree-multiset.js +76 -86
- package/lib/data-structures/graph/abstract-graph.d.ts +62 -62
- package/lib/data-structures/graph/abstract-graph.js +86 -86
- package/lib/data-structures/graph/directed-graph.d.ts +51 -51
- package/lib/data-structures/graph/directed-graph.js +63 -63
- package/lib/data-structures/graph/map-graph.d.ts +13 -13
- package/lib/data-structures/graph/map-graph.js +12 -12
- package/lib/data-structures/graph/undirected-graph.d.ts +30 -30
- package/lib/data-structures/graph/undirected-graph.js +32 -32
- package/lib/data-structures/priority-queue/priority-queue.d.ts +3 -3
- package/lib/data-structures/priority-queue/priority-queue.js +3 -3
- package/lib/data-structures/tree/tree.d.ts +4 -4
- package/lib/data-structures/tree/tree.js +6 -6
- package/lib/interfaces/abstract-binary-tree.d.ts +37 -42
- package/lib/interfaces/abstract-graph.d.ts +13 -13
- package/lib/interfaces/avl-tree.d.ts +6 -4
- package/lib/interfaces/bst.d.ts +10 -9
- package/lib/interfaces/directed-graph.d.ts +5 -5
- package/lib/interfaces/rb-tree.d.ts +2 -2
- package/lib/interfaces/undirected-graph.d.ts +2 -2
- package/lib/types/data-structures/abstract-binary-tree.d.ts +3 -3
- package/lib/types/data-structures/abstract-binary-tree.js +0 -1
- package/lib/types/data-structures/abstract-graph.d.ts +2 -2
- package/lib/types/data-structures/bst.d.ts +2 -2
- package/lib/types/data-structures/tree-multiset.d.ts +1 -1
- package/lib/types/utils/validate-type.d.ts +8 -8
- package/package.json +6 -6
- package/scripts/rename_clear_files.sh +29 -0
- package/src/data-structures/binary-tree/abstract-binary-tree.ts +241 -293
- package/src/data-structures/binary-tree/avl-tree.ts +43 -14
- package/src/data-structures/binary-tree/binary-tree.ts +8 -8
- package/src/data-structures/binary-tree/bst.ts +101 -96
- package/src/data-structures/binary-tree/rb-tree.ts +9 -9
- package/src/data-structures/binary-tree/tree-multiset.ts +82 -94
- package/src/data-structures/graph/abstract-graph.ts +114 -109
- package/src/data-structures/graph/directed-graph.ts +77 -77
- package/src/data-structures/graph/map-graph.ts +20 -15
- package/src/data-structures/graph/undirected-graph.ts +39 -39
- package/src/data-structures/priority-queue/priority-queue.ts +3 -3
- package/src/data-structures/tree/tree.ts +7 -7
- package/src/interfaces/abstract-binary-tree.ts +37 -50
- package/src/interfaces/abstract-graph.ts +13 -13
- package/src/interfaces/avl-tree.ts +6 -4
- package/src/interfaces/bst.ts +9 -9
- package/src/interfaces/directed-graph.ts +5 -5
- package/src/interfaces/rb-tree.ts +2 -2
- package/src/interfaces/undirected-graph.ts +2 -2
- package/src/types/data-structures/abstract-binary-tree.ts +3 -4
- package/src/types/data-structures/abstract-graph.ts +2 -2
- package/src/types/data-structures/bst.ts +2 -2
- package/src/types/data-structures/tree-multiset.ts +1 -1
- package/src/types/utils/validate-type.ts +10 -10
- package/test/integration/avl-tree.test.ts +24 -24
- package/test/integration/bst.test.ts +71 -71
- package/test/unit/data-structures/binary-tree/avl-tree.test.ts +28 -28
- package/test/unit/data-structures/binary-tree/binary-tree.test.ts +4 -12
- package/test/unit/data-structures/binary-tree/bst.test.ts +79 -79
- package/test/unit/data-structures/binary-tree/overall.test.ts +20 -20
- package/test/unit/data-structures/binary-tree/tree-multiset.test.ts +80 -80
- package/test/unit/data-structures/graph/directed-graph.test.ts +8 -8
- package/test/unit/data-structures/graph/map-graph.test.ts +4 -4
- package/test/unit/data-structures/graph/overall.test.ts +2 -2
- package/test/unit/data-structures/graph/undirected-graph.test.ts +1 -1
- package/test/unit/data-structures/priority-queue/priority-queue.test.ts +4 -5
- package/test/unit/data-structures/tree/tree.test.ts +2 -2
- package/umd/bundle.min.js +1 -1
- package/umd/bundle.min.js.map +1 -1
|
@@ -7,19 +7,19 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import {arrayRemove} from '../../utils';
|
|
9
9
|
import {AbstractEdge, AbstractGraph, AbstractVertex} from './abstract-graph';
|
|
10
|
-
import type {
|
|
10
|
+
import type {VertexKey} from '../../types';
|
|
11
11
|
import {IUNDirectedGraph} from '../../interfaces';
|
|
12
12
|
|
|
13
13
|
export class UndirectedVertex<V = any> extends AbstractVertex<V> {
|
|
14
14
|
/**
|
|
15
15
|
* The constructor function initializes a vertex with an optional value.
|
|
16
|
-
* @param {
|
|
16
|
+
* @param {VertexKey} key - The `key` parameter is of type `VertexKey` and represents the identifier of the vertex. It is
|
|
17
17
|
* used to uniquely identify the vertex within a graph or network.
|
|
18
18
|
* @param {V} [val] - The "val" parameter is an optional parameter of type V. It is used to initialize the value of the
|
|
19
19
|
* vertex. If no value is provided, the vertex will be initialized with a default value.
|
|
20
20
|
*/
|
|
21
|
-
constructor(
|
|
22
|
-
super(
|
|
21
|
+
constructor(key: VertexKey, val?: V) {
|
|
22
|
+
super(key, val);
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
|
|
@@ -27,25 +27,25 @@ export class UndirectedEdge<V = number> extends AbstractEdge<V> {
|
|
|
27
27
|
/**
|
|
28
28
|
* The constructor function creates an instance of a class with two vertex IDs, an optional weight, and an optional
|
|
29
29
|
* value.
|
|
30
|
-
* @param {
|
|
31
|
-
* @param {
|
|
30
|
+
* @param {VertexKey} v1 - The first vertex ID of the edge.
|
|
31
|
+
* @param {VertexKey} v2 - The parameter `v2` is a `VertexKey`, which represents the identifier of the second vertex in a
|
|
32
32
|
* graph edge.
|
|
33
33
|
* @param {number} [weight] - The weight parameter is an optional number that represents the weight of the edge.
|
|
34
34
|
* @param {V} [val] - The "val" parameter is an optional parameter of type V. It is used to store a value associated
|
|
35
35
|
* with the edge.
|
|
36
36
|
*/
|
|
37
|
-
constructor(v1:
|
|
37
|
+
constructor(v1: VertexKey, v2: VertexKey, weight?: number, val?: V) {
|
|
38
38
|
super(weight, val);
|
|
39
39
|
this._vertices = [v1, v2];
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
private _vertices: [
|
|
42
|
+
private _vertices: [VertexKey, VertexKey];
|
|
43
43
|
|
|
44
44
|
get vertices() {
|
|
45
45
|
return this._vertices;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
set vertices(v: [
|
|
48
|
+
set vertices(v: [VertexKey, VertexKey]) {
|
|
49
49
|
this._vertices = v;
|
|
50
50
|
}
|
|
51
51
|
}
|
|
@@ -73,40 +73,40 @@ export class UndirectedGraph<
|
|
|
73
73
|
|
|
74
74
|
/**
|
|
75
75
|
* The function creates a new vertex with an optional value and returns it.
|
|
76
|
-
* @param {
|
|
76
|
+
* @param {VertexKey} key - The `key` parameter is the unique identifier for the vertex. It is used to distinguish one
|
|
77
77
|
* vertex from another in the graph.
|
|
78
78
|
* @param [val] - The `val` parameter is an optional value that can be assigned to the vertex. If a value is provided,
|
|
79
|
-
* it will be used as the value of the vertex. If no value is provided, the `
|
|
79
|
+
* it will be used as the value of the vertex. If no value is provided, the `key` parameter will be used as the value of
|
|
80
80
|
* the vertex.
|
|
81
81
|
* @returns The method is returning a new instance of the `UndirectedVertex` class, casted as type `V`.
|
|
82
82
|
*/
|
|
83
|
-
override createVertex(
|
|
84
|
-
return new UndirectedVertex(
|
|
83
|
+
override createVertex(key: VertexKey, val?: V['val']): V {
|
|
84
|
+
return new UndirectedVertex(key, val ?? key) as V;
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
/**
|
|
88
88
|
* The function creates an undirected edge between two vertices with an optional weight and value.
|
|
89
|
-
* @param {
|
|
90
|
-
* @param {
|
|
89
|
+
* @param {VertexKey} v1 - The parameter `v1` represents the first vertex of the edge.
|
|
90
|
+
* @param {VertexKey} v2 - The parameter `v2` represents the second vertex of the edge.
|
|
91
91
|
* @param {number} [weight] - The `weight` parameter is an optional number that represents the weight of the edge. If
|
|
92
92
|
* no weight is provided, it defaults to 1.
|
|
93
93
|
* @param [val] - The `val` parameter is an optional value that can be assigned to the edge. It can be of any type and
|
|
94
94
|
* is used to store additional information or data associated with the edge.
|
|
95
95
|
* @returns a new instance of the `UndirectedEdge` class, which is casted as type `E`.
|
|
96
96
|
*/
|
|
97
|
-
override createEdge(v1:
|
|
97
|
+
override createEdge(v1: VertexKey, v2: VertexKey, weight?: number, val?: E['val']): E {
|
|
98
98
|
return new UndirectedEdge(v1, v2, weight ?? 1, val) as E;
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
/**
|
|
102
102
|
* The function `getEdge` returns the first edge that connects two vertices, or null if no such edge exists.
|
|
103
|
-
* @param {V | null |
|
|
104
|
-
* object), `null`, or `
|
|
105
|
-
* @param {V | null |
|
|
106
|
-
* object), `null`, or `
|
|
103
|
+
* @param {V | null | VertexKey} v1 - The parameter `v1` represents a vertex or vertex ID. It can be of type `V` (vertex
|
|
104
|
+
* object), `null`, or `VertexKey` (a string or number representing the ID of a vertex).
|
|
105
|
+
* @param {V | null | VertexKey} v2 - The parameter `v2` represents a vertex or vertex ID. It can be of type `V` (vertex
|
|
106
|
+
* object), `null`, or `VertexKey` (vertex ID).
|
|
107
107
|
* @returns an edge (E) or null.
|
|
108
108
|
*/
|
|
109
|
-
getEdge(v1: V | null |
|
|
109
|
+
getEdge(v1: V | null | VertexKey, v2: V | null | VertexKey): E | null {
|
|
110
110
|
let edges: E[] | undefined = [];
|
|
111
111
|
|
|
112
112
|
if (v1 !== null && v2 !== null) {
|
|
@@ -114,7 +114,7 @@ export class UndirectedGraph<
|
|
|
114
114
|
const vertex2: V | null = this._getVertex(v2);
|
|
115
115
|
|
|
116
116
|
if (vertex1 && vertex2) {
|
|
117
|
-
edges = this._edges.get(vertex1)?.filter(e => e.vertices.includes(vertex2.
|
|
117
|
+
edges = this._edges.get(vertex1)?.filter(e => e.vertices.includes(vertex2.key));
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
|
|
@@ -123,12 +123,12 @@ export class UndirectedGraph<
|
|
|
123
123
|
|
|
124
124
|
/**
|
|
125
125
|
* The function removes an edge between two vertices in a graph and returns the removed edge.
|
|
126
|
-
* @param {V |
|
|
127
|
-
* @param {V |
|
|
128
|
-
* (
|
|
126
|
+
* @param {V | VertexKey} v1 - The parameter `v1` represents either a vertex object (`V`) or a vertex ID (`VertexKey`).
|
|
127
|
+
* @param {V | VertexKey} v2 - V | VertexKey - This parameter can be either a vertex object (V) or a vertex ID
|
|
128
|
+
* (VertexKey). It represents the second vertex of the edge that needs to be removed.
|
|
129
129
|
* @returns the removed edge (E) if it exists, or null if either of the vertices (V) does not exist.
|
|
130
130
|
*/
|
|
131
|
-
removeEdgeBetween(v1: V |
|
|
131
|
+
removeEdgeBetween(v1: V | VertexKey, v2: V | VertexKey): E | null {
|
|
132
132
|
const vertex1: V | null = this._getVertex(v1);
|
|
133
133
|
const vertex2: V | null = this._getVertex(v2);
|
|
134
134
|
|
|
@@ -139,11 +139,11 @@ export class UndirectedGraph<
|
|
|
139
139
|
const v1Edges = this._edges.get(vertex1);
|
|
140
140
|
let removed: E | null = null;
|
|
141
141
|
if (v1Edges) {
|
|
142
|
-
removed = arrayRemove<E>(v1Edges, (e: E) => e.vertices.includes(vertex2.
|
|
142
|
+
removed = arrayRemove<E>(v1Edges, (e: E) => e.vertices.includes(vertex2.key))[0] || null;
|
|
143
143
|
}
|
|
144
144
|
const v2Edges = this._edges.get(vertex2);
|
|
145
145
|
if (v2Edges) {
|
|
146
|
-
arrayRemove<E>(v2Edges, (e: E) => e.vertices.includes(vertex1.
|
|
146
|
+
arrayRemove<E>(v2Edges, (e: E) => e.vertices.includes(vertex1.key));
|
|
147
147
|
}
|
|
148
148
|
return removed;
|
|
149
149
|
}
|
|
@@ -160,12 +160,12 @@ export class UndirectedGraph<
|
|
|
160
160
|
/**
|
|
161
161
|
* The function `degreeOf` returns the degree of a vertex in a graph, which is the number of edges connected to that
|
|
162
162
|
* vertex.
|
|
163
|
-
* @param {
|
|
163
|
+
* @param {VertexKey | V} vertexOrKey - The parameter `vertexOrKey` can be either a `VertexKey` or a `V`.
|
|
164
164
|
* @returns The function `degreeOf` returns the degree of a vertex in a graph. The degree of a vertex is the number of
|
|
165
165
|
* edges connected to that vertex.
|
|
166
166
|
*/
|
|
167
|
-
degreeOf(
|
|
168
|
-
const vertex = this._getVertex(
|
|
167
|
+
degreeOf(vertexOrKey: VertexKey | V): number {
|
|
168
|
+
const vertex = this._getVertex(vertexOrKey);
|
|
169
169
|
if (vertex) {
|
|
170
170
|
return this._edges.get(vertex)?.length || 0;
|
|
171
171
|
} else {
|
|
@@ -175,12 +175,12 @@ export class UndirectedGraph<
|
|
|
175
175
|
|
|
176
176
|
/**
|
|
177
177
|
* The function returns the edges of a given vertex or vertex ID.
|
|
178
|
-
* @param {
|
|
178
|
+
* @param {VertexKey | V} vertexOrKey - The parameter `vertexOrKey` can be either a `VertexKey` or a `V`. A `VertexKey` is a
|
|
179
179
|
* unique identifier for a vertex in a graph, while `V` represents the type of the vertex.
|
|
180
180
|
* @returns an array of edges.
|
|
181
181
|
*/
|
|
182
|
-
edgesOf(
|
|
183
|
-
const vertex = this._getVertex(
|
|
182
|
+
edgesOf(vertexOrKey: VertexKey | V): E[] {
|
|
183
|
+
const vertex = this._getVertex(vertexOrKey);
|
|
184
184
|
if (vertex) {
|
|
185
185
|
return this._edges.get(vertex) || [];
|
|
186
186
|
} else {
|
|
@@ -204,17 +204,17 @@ export class UndirectedGraph<
|
|
|
204
204
|
|
|
205
205
|
/**
|
|
206
206
|
* The function "getNeighbors" returns an array of neighboring vertices for a given vertex or vertex ID.
|
|
207
|
-
* @param {V |
|
|
208
|
-
* (`
|
|
207
|
+
* @param {V | VertexKey} vertexOrKey - The parameter `vertexOrKey` can be either a vertex object (`V`) or a vertex ID
|
|
208
|
+
* (`VertexKey`).
|
|
209
209
|
* @returns an array of vertices (V[]).
|
|
210
210
|
*/
|
|
211
|
-
getNeighbors(
|
|
211
|
+
getNeighbors(vertexOrKey: V | VertexKey): V[] {
|
|
212
212
|
const neighbors: V[] = [];
|
|
213
|
-
const vertex = this._getVertex(
|
|
213
|
+
const vertex = this._getVertex(vertexOrKey);
|
|
214
214
|
if (vertex) {
|
|
215
215
|
const neighborEdges = this.edgesOf(vertex);
|
|
216
216
|
for (const edge of neighborEdges) {
|
|
217
|
-
const neighbor = this._getVertex(edge.vertices.filter(e => e !== vertex.
|
|
217
|
+
const neighbor = this._getVertex(edge.vertices.filter(e => e !== vertex.key)[0]);
|
|
218
218
|
if (neighbor) {
|
|
219
219
|
neighbors.push(neighbor);
|
|
220
220
|
}
|
|
@@ -195,13 +195,13 @@ export class PriorityQueue<E = any> {
|
|
|
195
195
|
}
|
|
196
196
|
|
|
197
197
|
/**
|
|
198
|
-
* The
|
|
198
|
+
* The dfs function performs a depth-first search traversal on a binary tree and returns an array of visited nodes
|
|
199
199
|
* based on the specified traversal order.
|
|
200
200
|
* @param {PriorityQueueDFSOrderPattern} dfsMode - The dfsMode parameter is a string that specifies the order in which
|
|
201
|
-
* the nodes should be visited during the Depth-First Search (
|
|
201
|
+
* the nodes should be visited during the Depth-First Search (dfs) traversal. It can have one of the following values:
|
|
202
202
|
* @returns an array of type `(E | null)[]`.
|
|
203
203
|
*/
|
|
204
|
-
|
|
204
|
+
dfs(dfsMode: PriorityQueueDFSOrderPattern): (E | null)[] {
|
|
205
205
|
const visitedNode: (E | null)[] = [];
|
|
206
206
|
|
|
207
207
|
const traverse = (cur: number) => {
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
export class TreeNode<V = any> {
|
|
2
|
-
constructor(
|
|
3
|
-
this.
|
|
2
|
+
constructor(key: string, value?: V, children?: TreeNode<V>[]) {
|
|
3
|
+
this._key = key;
|
|
4
4
|
this._value = value || undefined;
|
|
5
5
|
this._children = children || [];
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
private
|
|
8
|
+
private _key: string;
|
|
9
9
|
|
|
10
|
-
get
|
|
11
|
-
return this.
|
|
10
|
+
get key(): string {
|
|
11
|
+
return this._key;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
set
|
|
15
|
-
this.
|
|
14
|
+
set key(value: string) {
|
|
15
|
+
this._key = value;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
private _value?: V | undefined;
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
AbstractBinaryTreeNodeProperties,
|
|
3
3
|
AbstractBinaryTreeNodeProperty,
|
|
4
4
|
BinaryTreeDeletedResult,
|
|
5
|
-
|
|
5
|
+
BinaryTreeNodeKey,
|
|
6
6
|
BinaryTreeNodePropertyName,
|
|
7
7
|
DFSOrderPattern,
|
|
8
8
|
FamilyPosition,
|
|
@@ -12,13 +12,9 @@ import {
|
|
|
12
12
|
import {AbstractBinaryTreeNode} from '../data-structures';
|
|
13
13
|
|
|
14
14
|
export interface IAbstractBinaryTreeNode<T, NEIGHBOR extends IAbstractBinaryTreeNode<T, NEIGHBOR>> {
|
|
15
|
-
|
|
15
|
+
key: BinaryTreeNodeKey;
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
get val(): T | undefined;
|
|
20
|
-
|
|
21
|
-
set val(v: T | undefined);
|
|
17
|
+
val: T | undefined;
|
|
22
18
|
|
|
23
19
|
get left(): NEIGHBOR | null | undefined;
|
|
24
20
|
|
|
@@ -28,23 +24,17 @@ export interface IAbstractBinaryTreeNode<T, NEIGHBOR extends IAbstractBinaryTree
|
|
|
28
24
|
|
|
29
25
|
set right(v: NEIGHBOR | null | undefined);
|
|
30
26
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
set parent(v: NEIGHBOR | null | undefined);
|
|
27
|
+
parent: NEIGHBOR | null | undefined;
|
|
34
28
|
|
|
35
29
|
get familyPosition(): FamilyPosition;
|
|
36
|
-
|
|
37
|
-
get height(): number;
|
|
38
|
-
|
|
39
|
-
set height(v: number);
|
|
40
30
|
}
|
|
41
31
|
|
|
42
32
|
export interface IAbstractBinaryTree<N extends AbstractBinaryTreeNode<N['val'], N>> {
|
|
43
|
-
createNode(
|
|
33
|
+
createNode(key: BinaryTreeNodeKey, val?: N['val'], count?: number): N | null;
|
|
44
34
|
|
|
45
35
|
get loopType(): LoopType;
|
|
46
36
|
|
|
47
|
-
get
|
|
37
|
+
get visitedKey(): BinaryTreeNodeKey[];
|
|
48
38
|
|
|
49
39
|
get visitedVal(): Array<N['val']>;
|
|
50
40
|
|
|
@@ -60,13 +50,13 @@ export interface IAbstractBinaryTree<N extends AbstractBinaryTreeNode<N['val'],
|
|
|
60
50
|
|
|
61
51
|
isEmpty(): boolean;
|
|
62
52
|
|
|
63
|
-
add(
|
|
53
|
+
add(key: BinaryTreeNodeKey | N, val?: N['val']): N | null | undefined;
|
|
64
54
|
|
|
65
|
-
addMany(
|
|
55
|
+
addMany(keysOrNodes: (BinaryTreeNodeKey | N | null)[], data?: N['val'][]): (N | null | undefined)[];
|
|
66
56
|
|
|
67
|
-
|
|
57
|
+
refill(keysOrNodes: (BinaryTreeNodeKey | N | null)[], data?: N[] | Array<N['val']>): boolean;
|
|
68
58
|
|
|
69
|
-
remove(
|
|
59
|
+
remove(key: BinaryTreeNodeKey, ignoreCount?: boolean): BinaryTreeDeletedResult<N>[];
|
|
70
60
|
|
|
71
61
|
getDepth(node: N): number;
|
|
72
62
|
|
|
@@ -76,11 +66,11 @@ export interface IAbstractBinaryTree<N extends AbstractBinaryTreeNode<N['val'],
|
|
|
76
66
|
|
|
77
67
|
isPerfectlyBalanced(beginRoot?: N | null): boolean;
|
|
78
68
|
|
|
79
|
-
getNodes(nodeProperty:
|
|
69
|
+
getNodes(nodeProperty: BinaryTreeNodeKey | N, propertyName?: BinaryTreeNodePropertyName, onlyOne?: boolean): N[];
|
|
80
70
|
|
|
81
|
-
has(nodeProperty:
|
|
71
|
+
has(nodeProperty: BinaryTreeNodeKey | N, propertyName?: BinaryTreeNodePropertyName): boolean;
|
|
82
72
|
|
|
83
|
-
get(nodeProperty:
|
|
73
|
+
get(nodeProperty: BinaryTreeNodeKey | N, propertyName?: BinaryTreeNodePropertyName): N | null;
|
|
84
74
|
|
|
85
75
|
getPathToRoot(node: N): N[];
|
|
86
76
|
|
|
@@ -108,48 +98,45 @@ export interface IAbstractBinaryTree<N extends AbstractBinaryTreeNode<N['val'],
|
|
|
108
98
|
|
|
109
99
|
subTreeAdd(subTreeRoot: N, delta: number, propertyName?: BinaryTreeNodePropertyName): boolean;
|
|
110
100
|
|
|
111
|
-
|
|
101
|
+
bfs(): BinaryTreeNodeKey[];
|
|
112
102
|
|
|
113
|
-
|
|
103
|
+
bfs(nodeOrPropertyName: 'key'): BinaryTreeNodeKey[];
|
|
114
104
|
|
|
115
|
-
|
|
105
|
+
bfs(nodeOrPropertyName: 'val'): N['val'][];
|
|
116
106
|
|
|
117
|
-
|
|
107
|
+
bfs(nodeOrPropertyName: 'node'): N[];
|
|
118
108
|
|
|
119
|
-
|
|
109
|
+
bfs(nodeOrPropertyName: 'count'): number[];
|
|
120
110
|
|
|
121
|
-
|
|
111
|
+
bfs(nodeOrPropertyName?: NodeOrPropertyName): AbstractBinaryTreeNodeProperties<N>;
|
|
122
112
|
|
|
123
|
-
|
|
113
|
+
dfs(): BinaryTreeNodeKey[];
|
|
124
114
|
|
|
125
|
-
|
|
115
|
+
dfs(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'key'): BinaryTreeNodeKey[];
|
|
126
116
|
|
|
127
|
-
|
|
117
|
+
dfs(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'val'): N[];
|
|
128
118
|
|
|
129
|
-
|
|
119
|
+
dfs(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'node'): N[];
|
|
130
120
|
|
|
131
|
-
|
|
121
|
+
dfs(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'count'): number[];
|
|
132
122
|
|
|
133
|
-
|
|
123
|
+
dfs(pattern?: 'in' | 'pre' | 'post', nodeOrPropertyName?: NodeOrPropertyName): AbstractBinaryTreeNodeProperties<N>;
|
|
134
124
|
|
|
135
|
-
|
|
125
|
+
dfsIterative(): BinaryTreeNodeKey[];
|
|
136
126
|
|
|
137
|
-
|
|
127
|
+
dfsIterative(pattern: DFSOrderPattern): BinaryTreeNodeKey[];
|
|
138
128
|
|
|
139
|
-
|
|
129
|
+
dfsIterative(pattern: DFSOrderPattern, nodeOrPropertyName: 'key'): BinaryTreeNodeKey[];
|
|
140
130
|
|
|
141
|
-
|
|
131
|
+
dfsIterative(pattern: DFSOrderPattern, nodeOrPropertyName: 'val'): N['val'][];
|
|
142
132
|
|
|
143
|
-
|
|
133
|
+
dfsIterative(pattern: DFSOrderPattern, nodeOrPropertyName: 'node'): N[];
|
|
144
134
|
|
|
145
|
-
|
|
146
|
-
pattern?: 'in' | 'pre' | 'post',
|
|
147
|
-
nodeOrPropertyName?: NodeOrPropertyName
|
|
148
|
-
): AbstractBinaryTreeNodeProperties<N>;
|
|
135
|
+
dfsIterative(pattern?: DFSOrderPattern, nodeOrPropertyName?: NodeOrPropertyName): AbstractBinaryTreeNodeProperties<N>;
|
|
149
136
|
|
|
150
|
-
levelIterative(node: N | null):
|
|
137
|
+
levelIterative(node: N | null): BinaryTreeNodeKey[];
|
|
151
138
|
|
|
152
|
-
levelIterative(node: N | null, nodeOrPropertyName?: '
|
|
139
|
+
levelIterative(node: N | null, nodeOrPropertyName?: 'key'): BinaryTreeNodeKey[];
|
|
153
140
|
|
|
154
141
|
levelIterative(node: N | null, nodeOrPropertyName?: 'val'): N['val'][];
|
|
155
142
|
|
|
@@ -159,9 +146,9 @@ export interface IAbstractBinaryTree<N extends AbstractBinaryTreeNode<N['val'],
|
|
|
159
146
|
|
|
160
147
|
levelIterative(node: N | null, nodeOrPropertyName?: NodeOrPropertyName): AbstractBinaryTreeNodeProperties<N>;
|
|
161
148
|
|
|
162
|
-
listLevels(node: N | null):
|
|
149
|
+
listLevels(node: N | null): BinaryTreeNodeKey[][];
|
|
163
150
|
|
|
164
|
-
listLevels(node: N | null, nodeOrPropertyName?: '
|
|
151
|
+
listLevels(node: N | null, nodeOrPropertyName?: 'key'): BinaryTreeNodeKey[][];
|
|
165
152
|
|
|
166
153
|
listLevels(node: N | null, nodeOrPropertyName?: 'val'): N['val'][][];
|
|
167
154
|
|
|
@@ -173,9 +160,9 @@ export interface IAbstractBinaryTree<N extends AbstractBinaryTreeNode<N['val'],
|
|
|
173
160
|
|
|
174
161
|
getPredecessor(node: N): N;
|
|
175
162
|
|
|
176
|
-
morris():
|
|
163
|
+
morris(): BinaryTreeNodeKey[];
|
|
177
164
|
|
|
178
|
-
morris(pattern?: DFSOrderPattern, nodeOrPropertyName?: '
|
|
165
|
+
morris(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'key'): BinaryTreeNodeKey[];
|
|
179
166
|
|
|
180
167
|
morris(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'val'): N[];
|
|
181
168
|
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {VertexKey} from '../types';
|
|
2
2
|
|
|
3
3
|
export interface IAbstractGraph<V, E> {
|
|
4
|
-
hasVertex(
|
|
4
|
+
hasVertex(vertexOrKey: V | VertexKey): boolean;
|
|
5
5
|
|
|
6
|
-
addVertex(
|
|
6
|
+
addVertex(key: VertexKey, val?: V): boolean;
|
|
7
7
|
|
|
8
|
-
removeVertex(
|
|
8
|
+
removeVertex(vertexOrKey: V | VertexKey): boolean;
|
|
9
9
|
|
|
10
|
-
removeAllVertices(vertices: V[] |
|
|
10
|
+
removeAllVertices(vertices: V[] | VertexKey[]): boolean;
|
|
11
11
|
|
|
12
|
-
degreeOf(
|
|
12
|
+
degreeOf(vertexOrKey: V | VertexKey): number;
|
|
13
13
|
|
|
14
|
-
edgesOf(
|
|
14
|
+
edgesOf(vertexOrKey: V | VertexKey): E[];
|
|
15
15
|
|
|
16
|
-
hasEdge(src: V |
|
|
16
|
+
hasEdge(src: V | VertexKey, dest: V | VertexKey): boolean;
|
|
17
17
|
|
|
18
|
-
getEdge(
|
|
18
|
+
getEdge(srcOrKey: V | VertexKey, destOrKey: V | VertexKey): E | null;
|
|
19
19
|
|
|
20
20
|
edgeSet(): E[];
|
|
21
21
|
|
|
22
|
-
addEdge(src: V |
|
|
22
|
+
addEdge(src: V | VertexKey, dest: V | VertexKey, weight: number, val: E): boolean;
|
|
23
23
|
|
|
24
24
|
removeEdge(edge: E): E | null;
|
|
25
25
|
|
|
26
|
-
setEdgeWeight(
|
|
26
|
+
setEdgeWeight(srcOrKey: V | VertexKey, destOrKey: V | VertexKey, weight: number): boolean;
|
|
27
27
|
|
|
28
|
-
getMinPathBetween(v1: V |
|
|
28
|
+
getMinPathBetween(v1: V | VertexKey, v2: V | VertexKey, isWeight?: boolean): V[] | null;
|
|
29
29
|
|
|
30
|
-
getNeighbors(
|
|
30
|
+
getNeighbors(vertexOrKey: V | VertexKey): V[];
|
|
31
31
|
}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import {AVLTreeNode} from '../data-structures';
|
|
2
2
|
import {IBST, IBSTNode} from './bst';
|
|
3
|
-
import {BinaryTreeDeletedResult,
|
|
3
|
+
import {BinaryTreeDeletedResult, BinaryTreeNodeKey} from '../types';
|
|
4
4
|
|
|
5
|
-
export
|
|
5
|
+
export interface IAVLTreeNode<T, NEIGHBOR extends IAVLTreeNode<T, NEIGHBOR>> extends IBSTNode<T, NEIGHBOR> {
|
|
6
|
+
height: number;
|
|
7
|
+
}
|
|
6
8
|
|
|
7
9
|
export interface IAVLTree<N extends AVLTreeNode<N['val'], N>> extends IBST<N> {
|
|
8
|
-
add(
|
|
10
|
+
add(key: BinaryTreeNodeKey, val?: N['val'] | null): N | null | undefined;
|
|
9
11
|
|
|
10
|
-
remove(
|
|
12
|
+
remove(key: BinaryTreeNodeKey): BinaryTreeDeletedResult<N>[];
|
|
11
13
|
|
|
12
14
|
// _balanceFactor(node: N): number
|
|
13
15
|
//
|
package/src/interfaces/bst.ts
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import {BSTNode} from '../data-structures';
|
|
2
2
|
import {IBinaryTree, IBinaryTreeNode} from './binary-tree';
|
|
3
|
-
import {BinaryTreeDeletedResult,
|
|
3
|
+
import {BinaryTreeDeletedResult, BinaryTreeNodeKey, BinaryTreeNodePropertyName} from '../types';
|
|
4
4
|
|
|
5
|
-
export
|
|
5
|
+
export interface IBSTNode<T, NEIGHBOR extends IBSTNode<T, NEIGHBOR>> extends IBinaryTreeNode<T, NEIGHBOR> {}
|
|
6
6
|
|
|
7
7
|
export interface IBST<N extends BSTNode<N['val'], N>> extends IBinaryTree<N> {
|
|
8
|
-
createNode(
|
|
8
|
+
createNode(key: BinaryTreeNodeKey, val?: N['val'], count?: number): N;
|
|
9
9
|
|
|
10
|
-
add(
|
|
10
|
+
add(key: BinaryTreeNodeKey, val?: N['val'] | null, count?: number): N | null | undefined;
|
|
11
11
|
|
|
12
|
-
get(nodeProperty:
|
|
12
|
+
get(nodeProperty: BinaryTreeNodeKey | N, propertyName?: BinaryTreeNodePropertyName): N | null;
|
|
13
13
|
|
|
14
|
-
lastKey():
|
|
14
|
+
lastKey(): BinaryTreeNodeKey;
|
|
15
15
|
|
|
16
|
-
remove(
|
|
16
|
+
remove(key: BinaryTreeNodeKey, ignoreCount?: boolean): BinaryTreeDeletedResult<N>[];
|
|
17
17
|
|
|
18
|
-
getNodes(nodeProperty:
|
|
18
|
+
getNodes(nodeProperty: BinaryTreeNodeKey | N, propertyName?: BinaryTreeNodePropertyName, onlyOne?: boolean): N[];
|
|
19
19
|
|
|
20
20
|
// --- start additional functions
|
|
21
21
|
|
|
22
|
-
lesserSum(
|
|
22
|
+
lesserSum(key: BinaryTreeNodeKey, propertyName?: BinaryTreeNodePropertyName): number;
|
|
23
23
|
|
|
24
24
|
allGreaterNodesAdd(node: N, delta: number, propertyName?: BinaryTreeNodePropertyName): boolean;
|
|
25
25
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {VertexKey} from '../types';
|
|
2
2
|
import {IAbstractGraph} from './abstract-graph';
|
|
3
3
|
|
|
4
4
|
export interface IDirectedGraph<V, E> extends IAbstractGraph<V, E> {
|
|
@@ -6,15 +6,15 @@ export interface IDirectedGraph<V, E> extends IAbstractGraph<V, E> {
|
|
|
6
6
|
|
|
7
7
|
outgoingEdgesOf(vertex: V): E[];
|
|
8
8
|
|
|
9
|
-
inDegreeOf(
|
|
9
|
+
inDegreeOf(vertexOrKey: V | VertexKey): number;
|
|
10
10
|
|
|
11
|
-
outDegreeOf(
|
|
11
|
+
outDegreeOf(vertexOrKey: V | VertexKey): number;
|
|
12
12
|
|
|
13
13
|
getEdgeSrc(e: E): V | null;
|
|
14
14
|
|
|
15
15
|
getEdgeDest(e: E): V | null;
|
|
16
16
|
|
|
17
|
-
removeEdgeSrcToDest(
|
|
17
|
+
removeEdgeSrcToDest(srcOrKey: V | VertexKey, destOrKey: V | VertexKey): E | null;
|
|
18
18
|
|
|
19
|
-
removeEdgesBetween(v1: V |
|
|
19
|
+
removeEdgesBetween(v1: V | VertexKey, v2: V | VertexKey): E[];
|
|
20
20
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {RBTreeNode} from '../data-structures';
|
|
2
2
|
import {IBST, IBSTNode} from './bst';
|
|
3
|
-
import {
|
|
3
|
+
import {BinaryTreeNodeKey} from '../types';
|
|
4
4
|
|
|
5
5
|
export type IRBTreeNode<T, NEIGHBOR extends IRBTreeNode<T, NEIGHBOR>> = IBSTNode<T, NEIGHBOR>;
|
|
6
6
|
|
|
7
7
|
export interface IRBTree<N extends RBTreeNode<N['val'], N>> extends IBST<N> {
|
|
8
|
-
createNode(
|
|
8
|
+
createNode(key: BinaryTreeNodeKey, val?: N['val'], count?: number): N;
|
|
9
9
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {VertexKey} from '../types';
|
|
2
2
|
import {IAbstractGraph} from './abstract-graph';
|
|
3
3
|
|
|
4
4
|
export interface IUNDirectedGraph<V, E> extends IAbstractGraph<V, E> {
|
|
5
|
-
removeEdgeBetween(v1: V |
|
|
5
|
+
removeEdgeBetween(v1: V | VertexKey, v2: V | VertexKey): E | null;
|
|
6
6
|
}
|
|
@@ -12,7 +12,6 @@ export enum LoopType {
|
|
|
12
12
|
RECURSIVE = 'RECURSIVE'
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
/* This enumeration defines the position of a node within a family tree composed of three associated nodes, where 'root' represents the root node of the family tree, 'left' represents the left child node, and 'right' represents the right child node. */
|
|
16
15
|
export enum FamilyPosition {
|
|
17
16
|
ROOT = 'ROOT',
|
|
18
17
|
LEFT = 'LEFT',
|
|
@@ -23,13 +22,13 @@ export enum FamilyPosition {
|
|
|
23
22
|
MAL_NODE = 'MAL_NODE'
|
|
24
23
|
}
|
|
25
24
|
|
|
26
|
-
export type BinaryTreeNodePropertyName = '
|
|
25
|
+
export type BinaryTreeNodePropertyName = 'key' | 'val';
|
|
27
26
|
|
|
28
27
|
export type NodeOrPropertyName = 'node' | BinaryTreeNodePropertyName;
|
|
29
28
|
|
|
30
29
|
export type DFSOrderPattern = 'in' | 'pre' | 'post';
|
|
31
30
|
|
|
32
|
-
export type
|
|
31
|
+
export type BinaryTreeNodeKey = number;
|
|
33
32
|
|
|
34
33
|
export type BinaryTreeDeletedResult<N> = { deleted: N | null | undefined; needBalanced: N | null };
|
|
35
34
|
|
|
@@ -37,7 +36,7 @@ export type AbstractBinaryTreeNodeProperty<N extends AbstractBinaryTreeNode<N['v
|
|
|
37
36
|
| N['val']
|
|
38
37
|
| N
|
|
39
38
|
| number
|
|
40
|
-
|
|
|
39
|
+
| BinaryTreeNodeKey;
|
|
41
40
|
|
|
42
41
|
|
|
43
42
|
export type AbstractBinaryTreeNodeProperties<N extends AbstractBinaryTreeNode<N['val'], N>> =
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {BSTNode} from '../../data-structures/binary-tree';
|
|
2
2
|
import type {BinaryTreeOptions} from './binary-tree';
|
|
3
|
-
import {
|
|
3
|
+
import {BinaryTreeNodeKey} from './abstract-binary-tree';
|
|
4
4
|
|
|
5
|
-
export type BSTComparator = (a:
|
|
5
|
+
export type BSTComparator = (a: BinaryTreeNodeKey, b: BinaryTreeNodeKey) => number;
|
|
6
6
|
|
|
7
7
|
// prettier-ignore
|
|
8
8
|
export type BSTNodeNested<T> = BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
|
@@ -3,4 +3,4 @@ import {AVLTreeOptions} from './avl-tree';
|
|
|
3
3
|
|
|
4
4
|
export type TreeMultisetNodeNested<T> = TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
|
5
5
|
|
|
6
|
-
export type TreeMultisetOptions = Omit<AVLTreeOptions, '
|
|
6
|
+
export type TreeMultisetOptions = Omit<AVLTreeOptions, 'isMergeDuplicatedNodeByKey'> & {}
|