bst-typed 1.19.45 → 1.20.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 +302 -197
- package/dist/index.d.ts +8 -1
- package/dist/index.js +11 -15
- package/package.json +2 -2
- package/dist/bst.d.ts +0 -1
- package/dist/bst.js +0 -6
package/README.md
CHANGED
|
@@ -1,179 +1,328 @@
|
|
|
1
1
|
# What
|
|
2
|
-
|
|
3
2
|
## Brief
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
Binary Tree, Binary Search Tree (BST), AVL Tree, Tree Multiset, Segment Tree, Binary Indexed Tree, Graph, Directed Graph, Undirected Graph, Linked List, Singly Linked List, Doubly Linked List, Queue, Object Deque, Array Deque, Stack, Hash, Coordinate Set, Coordinate Map, Heap, Priority Queue, Max Priority Queue, Min Priority Queue, Trie
|
|
7
|
-
|
|
8
|
-
## Algorithms list only a few out, you can discover more in API docs
|
|
9
|
-
|
|
10
|
-
DFS, DFSIterative, BFS, morris, Bellman-Ford Algorithm, Dijkstra's Algorithm, Floyd-Warshall Algorithm, Tarjan's Algorithm
|
|
3
|
+
This is a standalone BST (Binary Search Tree) data structure from the data-structure-typed collection. If you wish to access more data structures or advanced features, you can transition to directly installing the complete [data-structure-typed](https://www.npmjs.com/package/data-structure-typed) package
|
|
11
4
|
|
|
12
|
-
## Code design
|
|
13
|
-
By strictly adhering to object-oriented design (BinaryTree -> BST -> AVLTree -> TreeMultiset), you can seamlessly inherit the existing data structures to implement the customized ones you need. Object-oriented design stands as the optimal approach to data structure design.
|
|
14
5
|
|
|
15
6
|
# How
|
|
16
7
|
|
|
17
8
|
## install
|
|
9
|
+
### npm
|
|
10
|
+
```bash
|
|
11
|
+
npm i bst-typed
|
|
12
|
+
```
|
|
18
13
|
### yarn
|
|
19
|
-
|
|
20
14
|
```bash
|
|
21
|
-
yarn add
|
|
15
|
+
yarn add bst-typed
|
|
22
16
|
```
|
|
17
|
+
### methods
|
|
18
|
+

|
|
19
|
+
### snippet
|
|
20
|
+
#### TS
|
|
21
|
+
```typescript
|
|
22
|
+
import {BST, BSTNode} from 'data-structure-typed';
|
|
23
|
+
// /* or if you prefer */ import {BST, BSTNode} from 'bst-typed';
|
|
23
24
|
|
|
24
|
-
|
|
25
|
+
const bst = new BST();
|
|
26
|
+
bst instanceof BST; // true
|
|
27
|
+
bst.add(11);
|
|
28
|
+
bst.add(3);
|
|
29
|
+
const idsAndValues = [15, 1, 8, 13, 16, 2, 6, 9, 12, 14, 4, 7, 10, 5];
|
|
30
|
+
bst.addMany(idsAndValues);
|
|
31
|
+
bst.root instanceof BSTNode; // true
|
|
25
32
|
|
|
26
|
-
|
|
27
|
-
npm install data-structure-typed
|
|
28
|
-
```
|
|
33
|
+
if (bst.root) bst.root.id; // 11
|
|
29
34
|
|
|
30
|
-
|
|
35
|
+
bst.size; // 16
|
|
31
36
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
37
|
+
bst.has(6); // true
|
|
38
|
+
|
|
39
|
+
const node6 = bst.get(6);
|
|
40
|
+
node6 && bst.getHeight(6); // 2
|
|
41
|
+
node6 && bst.getDepth(6); // 3
|
|
42
|
+
|
|
43
|
+
const nodeId10 = bst.get(10);
|
|
44
|
+
nodeId10?.id; // 10
|
|
45
|
+
|
|
46
|
+
const nodeVal9 = bst.get(9, 'val');
|
|
47
|
+
nodeVal9?.id; // 9
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
const leftMost = bst.getLeftMost();
|
|
51
|
+
leftMost?.id; // 1
|
|
52
|
+
|
|
53
|
+
const node15 = bst.get(15);
|
|
54
|
+
const minNodeBySpecificNode = node15 && bst.getLeftMost(node15);
|
|
55
|
+
minNodeBySpecificNode?.id; // 12
|
|
56
|
+
|
|
57
|
+
const subTreeSum = node15 && bst.subTreeSum(15);
|
|
58
|
+
subTreeSum; // 70
|
|
59
|
+
|
|
60
|
+
const lesserSum = bst.lesserSum(10);
|
|
61
|
+
lesserSum; // 45
|
|
62
|
+
|
|
63
|
+
node15 instanceof BSTNode; // true
|
|
64
|
+
|
|
65
|
+
const node11 = bst.get(11);
|
|
66
|
+
node11 instanceof BSTNode; // true
|
|
67
|
+
|
|
68
|
+
const dfsInorderNodes = bst.DFS('in', 'node');
|
|
69
|
+
dfsInorderNodes[0].id; // 1
|
|
70
|
+
dfsInorderNodes[dfsInorderNodes.length - 1].id; // 16
|
|
71
|
+
|
|
72
|
+
bst.perfectlyBalance();
|
|
73
|
+
bst.isPerfectlyBalanced(); // true
|
|
74
|
+
|
|
75
|
+
const bfsNodesAfterBalanced = bst.BFS('node');
|
|
76
|
+
bfsNodesAfterBalanced[0].id; // 8);
|
|
77
|
+
bfsNodesAfterBalanced[bfsNodesAfterBalanced.length - 1].id; // 16
|
|
78
|
+
|
|
79
|
+
const removed11 = bst.remove(11, true);
|
|
80
|
+
removed11 instanceof Array; // true
|
|
74
81
|
|
|
82
|
+
|
|
83
|
+
if (removed11[0].deleted) removed11[0].deleted.id; // 11
|
|
84
|
+
|
|
85
|
+
bst.isAVLBalanced(); // true
|
|
86
|
+
|
|
87
|
+
bst.getHeight(15); // 1
|
|
88
|
+
|
|
89
|
+
const removed1 = bst.remove(1, true);
|
|
90
|
+
removed1 instanceof Array; // true
|
|
91
|
+
|
|
92
|
+
if (removed1[0].deleted) removed1[0].deleted.id; // 1
|
|
93
|
+
|
|
94
|
+
bst.isAVLBalanced(); // true
|
|
95
|
+
|
|
96
|
+
bst.getHeight(); // 4
|
|
97
|
+
|
|
98
|
+
const removed4 = bst.remove(4, true);
|
|
99
|
+
removed4 instanceof Array; // true
|
|
100
|
+
|
|
101
|
+
if (removed4[0].deleted) removed4[0].deleted.id; // 4
|
|
102
|
+
bst.isAVLBalanced(); // true
|
|
103
|
+
bst.getHeight(); // 4
|
|
104
|
+
|
|
105
|
+
const removed10 = bst.remove(10, true);
|
|
106
|
+
|
|
107
|
+
if (removed10[0].deleted) removed10[0].deleted.id; // 10
|
|
108
|
+
bst.isAVLBalanced(); // false
|
|
109
|
+
bst.getHeight(); // 4
|
|
110
|
+
|
|
111
|
+
const removed15 = bst.remove(15, true);
|
|
112
|
+
|
|
113
|
+
if (removed15[0].deleted) removed15[0].deleted.id; // 15
|
|
114
|
+
|
|
115
|
+
bst.isAVLBalanced(); // true
|
|
116
|
+
bst.getHeight(); // 3
|
|
117
|
+
|
|
118
|
+
const removed5 = bst.remove(5, true);
|
|
119
|
+
|
|
120
|
+
if (removed5[0].deleted) removed5[0].deleted.id; // 5
|
|
121
|
+
|
|
122
|
+
bst.isAVLBalanced(); // true
|
|
123
|
+
bst.getHeight(); // 3
|
|
124
|
+
|
|
125
|
+
const removed13 = bst.remove(13, true);
|
|
126
|
+
if (removed13[0].deleted) removed13[0].deleted.id; // 13
|
|
127
|
+
bst.isAVLBalanced(); // true
|
|
128
|
+
bst.getHeight(); // 3
|
|
129
|
+
|
|
130
|
+
const removed3 = bst.remove(3, true);
|
|
131
|
+
if (removed3[0].deleted) removed3[0].deleted.id; // 3
|
|
132
|
+
bst.isAVLBalanced(); // false
|
|
133
|
+
bst.getHeight(); // 3
|
|
134
|
+
|
|
135
|
+
const removed8 = bst.remove(8, true);
|
|
136
|
+
if (removed8[0].deleted) removed8[0].deleted.id; // 8
|
|
137
|
+
bst.isAVLBalanced(); // true
|
|
138
|
+
bst.getHeight(); // 3
|
|
139
|
+
|
|
140
|
+
const removed6 = bst.remove(6, true);
|
|
141
|
+
if (removed6[0].deleted) removed6[0].deleted.id; // 6
|
|
142
|
+
bst.remove(6, true).length; // 0
|
|
143
|
+
bst.isAVLBalanced(); // false
|
|
144
|
+
bst.getHeight(); // 3
|
|
145
|
+
|
|
146
|
+
const removed7 = bst.remove(7, true);
|
|
147
|
+
if (removed7[0].deleted) removed7[0].deleted.id; // 7
|
|
148
|
+
bst.isAVLBalanced(); // false
|
|
149
|
+
bst.getHeight(); // 3
|
|
150
|
+
|
|
151
|
+
const removed9 = bst.remove(9, true);
|
|
152
|
+
if (removed9[0].deleted) removed9[0].deleted.id; // 9
|
|
153
|
+
bst.isAVLBalanced(); // false
|
|
154
|
+
bst.getHeight(); // 3
|
|
155
|
+
|
|
156
|
+
const removed14 = bst.remove(14, true);
|
|
157
|
+
if (removed14[0].deleted) removed14[0].deleted.id; // 14
|
|
158
|
+
bst.isAVLBalanced(); // false
|
|
159
|
+
bst.getHeight(); // 2
|
|
160
|
+
|
|
161
|
+
bst.isAVLBalanced(); // false
|
|
162
|
+
|
|
163
|
+
const bfsIDs = bst.BFS();
|
|
164
|
+
bfsIDs[0]; // 2
|
|
165
|
+
bfsIDs[1]; // 12
|
|
166
|
+
bfsIDs[2]; // 16
|
|
167
|
+
|
|
168
|
+
const bfsNodes = bst.BFS('node');
|
|
169
|
+
bfsNodes[0].id; // 2
|
|
170
|
+
bfsNodes[1].id; // 12
|
|
171
|
+
bfsNodes[2].id; // 16
|
|
75
172
|
```
|
|
76
173
|
#### JS
|
|
77
174
|
```javascript
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
const bst = new BST();
|
|
81
|
-
bst.add(11);
|
|
82
|
-
bst.add(3);
|
|
83
|
-
bst.addMany([15, 1, 8, 13, 16, 2, 6, 9, 12, 14, 4, 7, 10, 5]);
|
|
84
|
-
bst.size === 16; // true
|
|
85
|
-
bst.has(6); // true
|
|
86
|
-
const node6 = bst.get(6);
|
|
87
|
-
bst.getHeight(6) === 2; // true
|
|
88
|
-
bst.getHeight() === 5; // true
|
|
89
|
-
bst.getDepth(6) === 3; // true
|
|
90
|
-
const leftMost = bst.getLeftMost();
|
|
91
|
-
leftMost?.id === 1; // true
|
|
92
|
-
expect(leftMost?.id).toBe(1);
|
|
93
|
-
bst.remove(6);
|
|
94
|
-
bst.get(6); // null
|
|
95
|
-
bst.isAVLBalanced(); // true or false
|
|
96
|
-
const bfsIDs = bst.BFS();
|
|
97
|
-
bfsIDs[0] === 11; // true
|
|
98
|
-
expect(bfsIDs[0]).toBe(11);
|
|
99
|
-
|
|
100
|
-
const objBST = new BST();
|
|
101
|
-
objBST.add(11, {id: 11, keyA: 11});
|
|
102
|
-
objBST.add(3, {id: 3, keyA: 3});
|
|
103
|
-
|
|
104
|
-
objBST.addMany([{id: 15, keyA: 15}, {id: 1, keyA: 1}, {id: 8, keyA: 8},
|
|
105
|
-
{id: 13, keyA: 13}, {id: 16, keyA: 16}, {id: 2, keyA: 2},
|
|
106
|
-
{id: 6, keyA: 6}, {id: 9, keyA: 9}, {id: 12, keyA: 12},
|
|
107
|
-
{id: 14, keyA: 14}, {id: 4, keyA: 4}, {id: 7, keyA: 7},
|
|
108
|
-
{id: 10, keyA: 10}, {id: 5, keyA: 5}]);
|
|
109
|
-
|
|
110
|
-
objBST.remove(11);
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
const avlTree = new AVLTree();
|
|
114
|
-
avlTree.addMany([11, 3, 15, 1, 8, 13, 16, 2, 6, 9, 12, 14, 4, 7, 10, 5])
|
|
115
|
-
avlTree.isAVLBalanced(); // true
|
|
116
|
-
avlTree.remove(10);
|
|
117
|
-
avlTree.isAVLBalanced(); // true
|
|
175
|
+
const {BST, BSTNode} = require('data-structure-typed');
|
|
176
|
+
// /* or if you prefer */ const {BST, BSTNode} = require('bst-typed');
|
|
118
177
|
|
|
119
|
-
|
|
178
|
+
const bst = new BST();
|
|
179
|
+
bst instanceof BST; // true
|
|
180
|
+
bst.add(11);
|
|
181
|
+
bst.add(3);
|
|
182
|
+
const idsAndValues = [15, 1, 8, 13, 16, 2, 6, 9, 12, 14, 4, 7, 10, 5];
|
|
183
|
+
bst.addMany(idsAndValues);
|
|
184
|
+
bst.root instanceof BSTNode; // true
|
|
120
185
|
|
|
121
|
-
|
|
186
|
+
if (bst.root) bst.root.id; // 11
|
|
122
187
|
|
|
123
|
-
|
|
124
|
-
```typescript
|
|
125
|
-
import {DirectedGraph} from 'data-structure-typed';
|
|
126
|
-
|
|
127
|
-
const graph = new DirectedGraph();
|
|
128
|
-
|
|
129
|
-
graph.addVertex('A');
|
|
130
|
-
graph.addVertex('B');
|
|
131
|
-
|
|
132
|
-
graph.hasVertex('A'); // true
|
|
133
|
-
graph.hasVertex('B'); // true
|
|
134
|
-
graph.hasVertex('C'); // false
|
|
135
|
-
|
|
136
|
-
graph.addEdge('A', 'B');
|
|
137
|
-
graph.hasEdge('A', 'B'); // true
|
|
138
|
-
graph.hasEdge('B', 'A'); // false
|
|
139
|
-
|
|
140
|
-
graph.removeEdgeSrcToDest('A', 'B');
|
|
141
|
-
graph.hasEdge('A', 'B'); // false
|
|
142
|
-
|
|
143
|
-
graph.addVertex('C');
|
|
144
|
-
|
|
145
|
-
graph.addEdge('A', 'B');
|
|
146
|
-
graph.addEdge('B', 'C');
|
|
147
|
-
|
|
148
|
-
const topologicalOrderIds = graph.topologicalSort(); // ['A', 'B', 'C']
|
|
149
|
-
```
|
|
188
|
+
bst.size; // 16
|
|
150
189
|
|
|
151
|
-
|
|
190
|
+
bst.has(6); // true
|
|
152
191
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
192
|
+
const node6 = bst.get(6);
|
|
193
|
+
node6 && bst.getHeight(6); // 2
|
|
194
|
+
node6 && bst.getDepth(6); // 3
|
|
195
|
+
|
|
196
|
+
const nodeId10 = bst.get(10);
|
|
197
|
+
nodeId10?.id; // 10
|
|
198
|
+
|
|
199
|
+
const nodeVal9 = bst.get(9, 'val');
|
|
200
|
+
nodeVal9?.id; // 9
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
const leftMost = bst.getLeftMost();
|
|
204
|
+
leftMost?.id; // 1
|
|
205
|
+
|
|
206
|
+
const node15 = bst.get(15);
|
|
207
|
+
const minNodeBySpecificNode = node15 && bst.getLeftMost(node15);
|
|
208
|
+
minNodeBySpecificNode?.id; // 12
|
|
209
|
+
|
|
210
|
+
const subTreeSum = node15 && bst.subTreeSum(15);
|
|
211
|
+
subTreeSum; // 70
|
|
212
|
+
|
|
213
|
+
const lesserSum = bst.lesserSum(10);
|
|
214
|
+
lesserSum; // 45
|
|
215
|
+
|
|
216
|
+
node15 instanceof BSTNode; // true
|
|
217
|
+
|
|
218
|
+
const node11 = bst.get(11);
|
|
219
|
+
node11 instanceof BSTNode; // true
|
|
220
|
+
|
|
221
|
+
const dfsInorderNodes = bst.DFS('in', 'node');
|
|
222
|
+
dfsInorderNodes[0].id; // 1
|
|
223
|
+
dfsInorderNodes[dfsInorderNodes.length - 1].id; // 16
|
|
224
|
+
|
|
225
|
+
bst.perfectlyBalance();
|
|
226
|
+
bst.isPerfectlyBalanced(); // true
|
|
227
|
+
|
|
228
|
+
const bfsNodesAfterBalanced = bst.BFS('node');
|
|
229
|
+
bfsNodesAfterBalanced[0].id; // 8);
|
|
230
|
+
bfsNodesAfterBalanced[bfsNodesAfterBalanced.length - 1].id; // 16
|
|
231
|
+
|
|
232
|
+
const removed11 = bst.remove(11, true);
|
|
233
|
+
removed11 instanceof Array; // true
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
if (removed11[0].deleted) removed11[0].deleted.id; // 11
|
|
237
|
+
|
|
238
|
+
bst.isAVLBalanced(); // true
|
|
239
|
+
|
|
240
|
+
bst.getHeight(15); // 1
|
|
241
|
+
|
|
242
|
+
const removed1 = bst.remove(1, true);
|
|
243
|
+
removed1 instanceof Array; // true
|
|
244
|
+
|
|
245
|
+
if (removed1[0].deleted) removed1[0].deleted.id; // 1
|
|
246
|
+
|
|
247
|
+
bst.isAVLBalanced(); // true
|
|
248
|
+
|
|
249
|
+
bst.getHeight(); // 4
|
|
250
|
+
|
|
251
|
+
const removed4 = bst.remove(4, true);
|
|
252
|
+
removed4 instanceof Array; // true
|
|
253
|
+
|
|
254
|
+
if (removed4[0].deleted) removed4[0].deleted.id; // 4
|
|
255
|
+
bst.isAVLBalanced(); // true
|
|
256
|
+
bst.getHeight(); // 4
|
|
257
|
+
|
|
258
|
+
const removed10 = bst.remove(10, true);
|
|
259
|
+
|
|
260
|
+
if (removed10[0].deleted) removed10[0].deleted.id; // 10
|
|
261
|
+
bst.isAVLBalanced(); // false
|
|
262
|
+
bst.getHeight(); // 4
|
|
263
|
+
|
|
264
|
+
const removed15 = bst.remove(15, true);
|
|
169
265
|
|
|
170
|
-
|
|
266
|
+
if (removed15[0].deleted) removed15[0].deleted.id; // 15
|
|
171
267
|
|
|
172
|
-
|
|
268
|
+
bst.isAVLBalanced(); // true
|
|
269
|
+
bst.getHeight(); // 3
|
|
173
270
|
|
|
174
|
-
|
|
271
|
+
const removed5 = bst.remove(5, true);
|
|
175
272
|
|
|
176
|
-
|
|
273
|
+
if (removed5[0].deleted) removed5[0].deleted.id; // 5
|
|
274
|
+
|
|
275
|
+
bst.isAVLBalanced(); // true
|
|
276
|
+
bst.getHeight(); // 3
|
|
277
|
+
|
|
278
|
+
const removed13 = bst.remove(13, true);
|
|
279
|
+
if (removed13[0].deleted) removed13[0].deleted.id; // 13
|
|
280
|
+
bst.isAVLBalanced(); // true
|
|
281
|
+
bst.getHeight(); // 3
|
|
282
|
+
|
|
283
|
+
const removed3 = bst.remove(3, true);
|
|
284
|
+
if (removed3[0].deleted) removed3[0].deleted.id; // 3
|
|
285
|
+
bst.isAVLBalanced(); // false
|
|
286
|
+
bst.getHeight(); // 3
|
|
287
|
+
|
|
288
|
+
const removed8 = bst.remove(8, true);
|
|
289
|
+
if (removed8[0].deleted) removed8[0].deleted.id; // 8
|
|
290
|
+
bst.isAVLBalanced(); // true
|
|
291
|
+
bst.getHeight(); // 3
|
|
292
|
+
|
|
293
|
+
const removed6 = bst.remove(6, true);
|
|
294
|
+
if (removed6[0].deleted) removed6[0].deleted.id; // 6
|
|
295
|
+
bst.remove(6, true).length; // 0
|
|
296
|
+
bst.isAVLBalanced(); // false
|
|
297
|
+
bst.getHeight(); // 3
|
|
298
|
+
|
|
299
|
+
const removed7 = bst.remove(7, true);
|
|
300
|
+
if (removed7[0].deleted) removed7[0].deleted.id; // 7
|
|
301
|
+
bst.isAVLBalanced(); // false
|
|
302
|
+
bst.getHeight(); // 3
|
|
303
|
+
|
|
304
|
+
const removed9 = bst.remove(9, true);
|
|
305
|
+
if (removed9[0].deleted) removed9[0].deleted.id; // 9
|
|
306
|
+
bst.isAVLBalanced(); // false
|
|
307
|
+
bst.getHeight(); // 3
|
|
308
|
+
|
|
309
|
+
const removed14 = bst.remove(14, true);
|
|
310
|
+
if (removed14[0].deleted) removed14[0].deleted.id; // 14
|
|
311
|
+
bst.isAVLBalanced(); // false
|
|
312
|
+
bst.getHeight(); // 2
|
|
313
|
+
|
|
314
|
+
bst.isAVLBalanced(); // false
|
|
315
|
+
|
|
316
|
+
const bfsIDs = bst.BFS();
|
|
317
|
+
bfsIDs[0]; // 2
|
|
318
|
+
bfsIDs[1]; // 12
|
|
319
|
+
bfsIDs[2]; // 16
|
|
320
|
+
|
|
321
|
+
const bfsNodes = bst.BFS('node');
|
|
322
|
+
bfsNodes[0].id; // 2
|
|
323
|
+
bfsNodes[1].id; // 12
|
|
324
|
+
bfsNodes[2].id; // 16
|
|
325
|
+
```
|
|
177
326
|
|
|
178
327
|
|
|
179
328
|
## API docs & Examples
|
|
@@ -182,10 +331,6 @@ import {UndirectedGraph} from 'data-structure-typed';
|
|
|
182
331
|
|
|
183
332
|
[Live Examples](https://data-structure-typed-examples.vercel.app)
|
|
184
333
|
|
|
185
|
-
<a href="https://data-structure-typed-examples.vercel.app" target="_blank">Live Examples</a>
|
|
186
|
-
|
|
187
|
-
[//]: # ([Examples Repository](https://github.com/zrwusa/data-structure-typed-examples))
|
|
188
|
-
|
|
189
334
|
<a href="https://github.com/zrwusa/data-structure-typed-examples" target="_blank">Examples Repository</a>
|
|
190
335
|
|
|
191
336
|
## Data Structures
|
|
@@ -203,10 +348,10 @@ import {UndirectedGraph} from 'data-structure-typed';
|
|
|
203
348
|
<tbody>
|
|
204
349
|
<tr>
|
|
205
350
|
<td>Binary Tree</td>
|
|
206
|
-
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""
|
|
207
|
-
</
|
|
208
|
-
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""
|
|
209
|
-
</
|
|
351
|
+
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""/>
|
|
352
|
+
</td>
|
|
353
|
+
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""/>
|
|
354
|
+
</td>
|
|
210
355
|
<td><a href="https://data-structure-typed-docs.vercel.app/classes/BinaryTree.html"><span>Binary Tree</span></a></td>
|
|
211
356
|
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
212
357
|
</tr>
|
|
@@ -653,46 +798,6 @@ import {UndirectedGraph} from 'data-structure-typed';
|
|
|
653
798
|
|
|
654
799
|

|
|
655
800
|
|
|
656
|
-
[//]: # ()
|
|
657
|
-
|
|
658
|
-
[//]: # ()
|
|
659
|
-
[//]: # ()
|
|
660
|
-
|
|
661
|
-
[//]: # ()
|
|
662
|
-
[//]: # ()
|
|
663
|
-
|
|
664
|
-
[//]: # ()
|
|
665
|
-
[//]: # ()
|
|
666
|
-
|
|
667
|
-
[//]: # ()
|
|
668
|
-
[//]: # ()
|
|
669
|
-
|
|
670
|
-
[//]: # ()
|
|
671
|
-
[//]: # ()
|
|
672
|
-
|
|
673
|
-
[//]: # ()
|
|
674
|
-
[//]: # ()
|
|
675
|
-
|
|
676
|
-
[//]: # ()
|
|
677
|
-
[//]: # ()
|
|
678
|
-
|
|
679
|
-
[//]: # ()
|
|
680
|
-
[//]: # ()
|
|
681
|
-
|
|
682
|
-
[//]: # ()
|
|
683
|
-
[//]: # ()
|
|
684
|
-
|
|
685
|
-
[//]: # ()
|
|
686
|
-
[//]: # ()
|
|
687
|
-
|
|
688
|
-
[//]: # ()
|
|
689
|
-
[//]: # ()
|
|
690
|
-
|
|
691
|
-
[//]: # ()
|
|
692
|
-
|
|
693
|
-
[//]: # ()
|
|
694
|
-
|
|
695
|
-
[//]: # ()
|
|
696
801
|
|
|
697
802
|
|
|
698
803
|
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
|
|
3
|
+
exports.BST = exports.BSTNode = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* data-structure-typed
|
|
6
|
+
*
|
|
7
|
+
* @author Tyler Zeng
|
|
8
|
+
* @copyright Copyright (c) 2022 Tyler Zeng <zrwusa@gmail.com>
|
|
9
|
+
* @license MIT License
|
|
10
|
+
*/
|
|
11
|
+
var data_structure_typed_1 = require("data-structure-typed");
|
|
12
|
+
Object.defineProperty(exports, "BSTNode", { enumerable: true, get: function () { return data_structure_typed_1.BSTNode; } });
|
|
13
|
+
Object.defineProperty(exports, "BST", { enumerable: true, get: function () { return data_structure_typed_1.BST; } });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bst-typed",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.20.0",
|
|
4
4
|
"description": "BST (Binary Search Tree). Javascript & Typescript Data Structure.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"typescript": "^4.9.5"
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"data-structure-typed": "^1.
|
|
68
|
+
"data-structure-typed": "^1.20.0",
|
|
69
69
|
"zod": "^3.22.2"
|
|
70
70
|
}
|
|
71
71
|
}
|
package/dist/bst.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { BSTNode, BST } from 'data-structure-typed';
|
package/dist/bst.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BST = exports.BSTNode = void 0;
|
|
4
|
-
var data_structure_typed_1 = require("data-structure-typed");
|
|
5
|
-
Object.defineProperty(exports, "BSTNode", { enumerable: true, get: function () { return data_structure_typed_1.BSTNode; } });
|
|
6
|
-
Object.defineProperty(exports, "BST", { enumerable: true, get: function () { return data_structure_typed_1.BST; } });
|