graph-typed 1.47.2 → 1.47.4
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 +410 -355
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -183,13 +183,14 @@ expect(surinToSaanenGoatFarmViaDij?.minPath.map(v => v.id)).toEqual(expected2);
|
|
|
183
183
|
expect(surinToSaanenGoatFarmViaDij?.minDist).toBe(25.2);
|
|
184
184
|
```
|
|
185
185
|
|
|
186
|
+
|
|
186
187
|
## API docs & Examples
|
|
187
188
|
|
|
188
189
|
[API Docs](https://data-structure-typed-docs.vercel.app)
|
|
189
190
|
|
|
190
|
-
[Live Examples](https://
|
|
191
|
+
[Live Examples](https://vivid-algorithm.vercel.app)
|
|
191
192
|
|
|
192
|
-
<a href="https://github.com/zrwusa/
|
|
193
|
+
<a href="https://github.com/zrwusa/vivid-algorithm" target="_blank">Examples Repository</a>
|
|
193
194
|
|
|
194
195
|
## Data Structures
|
|
195
196
|
|
|
@@ -199,464 +200,518 @@ expect(surinToSaanenGoatFarmViaDij?.minDist).toBe(25.2);
|
|
|
199
200
|
<th>Data Structure</th>
|
|
200
201
|
<th>Unit Test</th>
|
|
201
202
|
<th>Performance Test</th>
|
|
202
|
-
<th>API
|
|
203
|
-
<th>Implemented</th>
|
|
203
|
+
<th>API Docs</th>
|
|
204
204
|
</tr>
|
|
205
205
|
</thead>
|
|
206
206
|
<tbody>
|
|
207
207
|
<tr>
|
|
208
208
|
<td>Binary Tree</td>
|
|
209
|
-
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""/>
|
|
210
|
-
</td>
|
|
211
|
-
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""/>
|
|
212
|
-
</td>
|
|
213
|
-
<td><a href="https://data-structure-typed-docs.vercel.app/classes/BinaryTree.html"><span>Binary Tree</span></a></td>
|
|
214
209
|
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
210
|
+
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
211
|
+
<td><a href="https://data-structure-typed-docs.vercel.app/classes/BinaryTree.html"><span>Binary Tree</span></a></td>
|
|
215
212
|
</tr>
|
|
216
213
|
<tr>
|
|
217
214
|
<td>Binary Search Tree (BST)</td>
|
|
218
215
|
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
219
216
|
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
220
217
|
<td><a href="https://data-structure-typed-docs.vercel.app/classes/BST.html"><span>BST</span></a></td>
|
|
221
|
-
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
222
218
|
</tr>
|
|
223
219
|
<tr>
|
|
224
220
|
<td>AVL Tree</td>
|
|
225
221
|
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
226
222
|
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
227
223
|
<td><a href="https://data-structure-typed-docs.vercel.app/classes/AVLTree.html"><span>AVLTree</span></a></td>
|
|
224
|
+
</tr>
|
|
225
|
+
<tr>
|
|
226
|
+
<td>Red Black Tree</td>
|
|
228
227
|
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
228
|
+
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
229
|
+
<td><a href="https://data-structure-typed-docs.vercel.app/classes/RedBlackTree.html"><span>RedBlackTree</span></a></td>
|
|
229
230
|
</tr>
|
|
230
231
|
<tr>
|
|
231
232
|
<td>Tree Multiset</td>
|
|
232
233
|
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
233
234
|
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
234
235
|
<td><a href="https://data-structure-typed-docs.vercel.app/classes/TreeMultimap.html"><span>TreeMultimap</span></a></td>
|
|
235
|
-
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
236
236
|
</tr>
|
|
237
237
|
<tr>
|
|
238
238
|
<td>Segment Tree</td>
|
|
239
|
-
<td></td>
|
|
239
|
+
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
240
240
|
<td></td>
|
|
241
241
|
<td><a href="https://data-structure-typed-docs.vercel.app/classes/SegmentTree.html"><span>SegmentTree</span></a></td>
|
|
242
|
-
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
243
242
|
</tr>
|
|
244
243
|
<tr>
|
|
245
244
|
<td>Binary Indexed Tree</td>
|
|
246
245
|
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
247
246
|
<td></td>
|
|
248
247
|
<td><a href="https://data-structure-typed-docs.vercel.app/classes/BinaryIndexedTree.html"><span>BinaryIndexedTree</span></a></td>
|
|
249
|
-
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
250
248
|
</tr>
|
|
251
249
|
<tr>
|
|
252
|
-
<td>
|
|
253
|
-
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
254
|
-
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
255
|
-
<td><a href="https://data-structure-typed-docs.vercel.app/classes/AbstractGraph.html"><span>AbstractGraph</span></a></td>
|
|
256
|
-
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
257
|
-
</tr>
|
|
258
|
-
<tr>
|
|
259
|
-
<td>Directed Graph</td>
|
|
260
|
-
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
250
|
+
<td>Heap</td>
|
|
261
251
|
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
262
|
-
<td><a href="https://data-structure-typed-docs.vercel.app/classes/DirectedGraph.html"><span>DirectedGraph</span></a></td>
|
|
263
252
|
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
253
|
+
<td><a href="https://data-structure-typed-docs.vercel.app/classes/Heap.html"><span>Heap</span></a></td>
|
|
264
254
|
</tr>
|
|
265
255
|
<tr>
|
|
266
|
-
<td>
|
|
267
|
-
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
256
|
+
<td>Priority Queue</td>
|
|
268
257
|
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
269
|
-
<td><a href="https://data-structure-typed-docs.vercel.app/classes/UndirectedGraph.html"><span>UndirectedGraph</span></a></td>
|
|
270
258
|
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
259
|
+
<td><a href="https://data-structure-typed-docs.vercel.app/classes/PriorityQueue.html"><span>PriorityQueue</span></a></td>
|
|
271
260
|
</tr>
|
|
272
261
|
<tr>
|
|
273
|
-
<td>
|
|
274
|
-
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
262
|
+
<td>Max Priority Queue</td>
|
|
275
263
|
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
276
|
-
<td><a href="https://data-structure-typed-docs.vercel.app/classes/SinglyLinkedList.html"><span>SinglyLinkedList</span></a></td>
|
|
277
264
|
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
265
|
+
<td><a href="https://data-structure-typed-docs.vercel.app/classes/MaxPriorityQueue.html"><span>MaxPriorityQueue</span></a></td>
|
|
278
266
|
</tr>
|
|
279
267
|
<tr>
|
|
280
|
-
<td>
|
|
281
|
-
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
268
|
+
<td>Min Priority Queue</td>
|
|
282
269
|
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
283
|
-
<td><a href="https://data-structure-typed-docs.vercel.app/classes/SinglyLinkedList.html"><span>SinglyLinkedList</span></a></td>
|
|
284
270
|
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
271
|
+
<td><a href="https://data-structure-typed-docs.vercel.app/classes/MinPriorityQueue.html"><span>MinPriorityQueue</span></a></td>
|
|
285
272
|
</tr>
|
|
286
273
|
<tr>
|
|
287
|
-
<td>
|
|
288
|
-
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
274
|
+
<td>Trie</td>
|
|
289
275
|
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
290
|
-
<td><a href="https://data-structure-typed-docs.vercel.app/classes/DoublyLinkedList.html"><span>DoublyLinkedList</span></a></td>
|
|
291
276
|
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
277
|
+
<td><a href="https://data-structure-typed-docs.vercel.app/classes/Trie.html"><span>Trie</span></a></td>
|
|
292
278
|
</tr>
|
|
293
279
|
<tr>
|
|
294
|
-
<td>
|
|
295
|
-
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
280
|
+
<td>Graph</td>
|
|
296
281
|
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
297
|
-
<td><a href="https://data-structure-typed-docs.vercel.app/classes/Queue.html"><span>Queue</span></a></td>
|
|
298
282
|
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
283
|
+
<td><a href="https://data-structure-typed-docs.vercel.app/classes/AbstractGraph.html"><span>AbstractGraph</span></a></td>
|
|
299
284
|
</tr>
|
|
300
285
|
<tr>
|
|
301
|
-
<td>
|
|
302
|
-
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
286
|
+
<td>Directed Graph</td>
|
|
303
287
|
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
304
|
-
<td><a href="https://data-structure-typed-docs.vercel.app/classes/ObjectDeque.html"><span>ObjectDeque</span></a></td>
|
|
305
288
|
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
289
|
+
<td><a href="https://data-structure-typed-docs.vercel.app/classes/DirectedGraph.html"><span>DirectedGraph</span></a></td>
|
|
306
290
|
</tr>
|
|
307
291
|
<tr>
|
|
308
|
-
<td>
|
|
309
|
-
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
292
|
+
<td>Undirected Graph</td>
|
|
310
293
|
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
311
|
-
<td><a href="https://data-structure-typed-docs.vercel.app/classes/ArrayDeque.html"><span>ArrayDeque</span></a></td>
|
|
312
294
|
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
295
|
+
<td><a href="https://data-structure-typed-docs.vercel.app/classes/UndirectedGraph.html"><span>UndirectedGraph</span></a></td>
|
|
313
296
|
</tr>
|
|
314
297
|
<tr>
|
|
315
|
-
<td>
|
|
298
|
+
<td>Queue</td>
|
|
316
299
|
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
317
|
-
<td></td>
|
|
318
|
-
<td><a href="https://data-structure-typed-docs.vercel.app/classes/Stack.html"><span>Stack</span></a></td>
|
|
319
300
|
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
301
|
+
<td><a href="https://data-structure-typed-docs.vercel.app/classes/Queue.html"><span>Queue</span></a></td>
|
|
320
302
|
</tr>
|
|
321
|
-
|
|
322
|
-
[//]: # (<tr>)
|
|
323
|
-
|
|
324
|
-
[//]: # (<td>Hash</td>)
|
|
325
|
-
|
|
326
|
-
[//]: # (<td></td>)
|
|
327
|
-
|
|
328
|
-
[//]: # (<td></td>)
|
|
329
|
-
|
|
330
|
-
[//]: # (<td><a href="https://data-structure-typed-docs.vercel.app/classes/HashTable.html"><span>HashTable</span></a></td>)
|
|
331
|
-
|
|
332
|
-
[//]: # (<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>)
|
|
333
|
-
|
|
334
|
-
[//]: # (</tr>)
|
|
335
303
|
<tr>
|
|
336
|
-
<td>
|
|
337
|
-
<td></td>
|
|
338
|
-
<td></td>
|
|
339
|
-
<td><a href="https://data-structure-typed-docs.vercel.app/classes/CoordinateSet.html"><span>CoordinateSet</span></a></td>
|
|
304
|
+
<td>Deque</td>
|
|
340
305
|
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
341
|
-
</tr>
|
|
342
|
-
<tr>
|
|
343
|
-
<td>Coordinate Map</td>
|
|
344
|
-
<td></td>
|
|
345
|
-
<td></td>
|
|
346
|
-
<td><a href="https://data-structure-typed-docs.vercel.app/classes/CoordinateMap.html"><span>CoordinateMap</span></a></td>
|
|
347
306
|
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
307
|
+
<td><a href="https://data-structure-typed-docs.vercel.app/classes/Deque.html"><span>Deque</span></a></td>
|
|
348
308
|
</tr>
|
|
349
309
|
<tr>
|
|
350
|
-
<td>
|
|
351
|
-
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
310
|
+
<td>Linked List</td>
|
|
352
311
|
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
353
|
-
<td><a href="https://data-structure-typed-docs.vercel.app/classes/Heap.html"><span>Heap</span></a></td>
|
|
354
312
|
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
313
|
+
<td><a href="https://data-structure-typed-docs.vercel.app/classes/SinglyLinkedList.html"><span>SinglyLinkedList</span></a></td>
|
|
355
314
|
</tr>
|
|
356
315
|
<tr>
|
|
357
|
-
<td>
|
|
358
|
-
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
316
|
+
<td>Singly Linked List</td>
|
|
359
317
|
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
360
|
-
<td><a href="https://data-structure-typed-docs.vercel.app/classes/PriorityQueue.html"><span>PriorityQueue</span></a></td>
|
|
361
318
|
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
319
|
+
<td><a href="https://data-structure-typed-docs.vercel.app/classes/SinglyLinkedList.html"><span>SinglyLinkedList</span></a></td>
|
|
362
320
|
</tr>
|
|
363
321
|
<tr>
|
|
364
|
-
<td>
|
|
365
|
-
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
322
|
+
<td>Doubly Linked List</td>
|
|
366
323
|
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
367
|
-
<td><a href="https://data-structure-typed-docs.vercel.app/classes/MaxPriorityQueue.html"><span>MaxPriorityQueue</span></a></td>
|
|
368
324
|
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
325
|
+
<td><a href="https://data-structure-typed-docs.vercel.app/classes/DoublyLinkedList.html"><span>DoublyLinkedList</span></a></td>
|
|
369
326
|
</tr>
|
|
370
327
|
<tr>
|
|
371
|
-
<td>
|
|
372
|
-
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
373
|
-
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
374
|
-
<td><a href="https://data-structure-typed-docs.vercel.app/classes/MinPriorityQueue.html"><span>MinPriorityQueue</span></a></td>
|
|
328
|
+
<td>Stack</td>
|
|
375
329
|
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
376
|
-
</tr>
|
|
377
|
-
<tr>
|
|
378
|
-
<td>Trie</td>
|
|
379
|
-
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
380
|
-
<td></td>
|
|
381
|
-
<td><a href="https://data-structure-typed-docs.vercel.app/classes/Trie.html"><span>Trie</span></a></td>
|
|
382
330
|
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
331
|
+
<td><a href="https://data-structure-typed-docs.vercel.app/classes/Stack.html"><span>Stack</span></a></td>
|
|
383
332
|
</tr>
|
|
384
333
|
</tbody>
|
|
385
334
|
</table>
|
|
386
335
|
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
## Complexities
|
|
390
|
-
|
|
391
|
-
### performance of Big O
|
|
336
|
+
## Standard library data structure comparison
|
|
392
337
|
|
|
393
338
|
<table>
|
|
394
|
-
<thead>
|
|
395
|
-
<tr>
|
|
396
|
-
<th>
|
|
397
|
-
<th>
|
|
398
|
-
<th>
|
|
399
|
-
<th>
|
|
400
|
-
|
|
401
|
-
</
|
|
402
|
-
|
|
403
|
-
<
|
|
404
|
-
<
|
|
405
|
-
<td
|
|
406
|
-
<td>
|
|
407
|
-
<td>
|
|
408
|
-
|
|
409
|
-
<
|
|
410
|
-
|
|
411
|
-
<
|
|
412
|
-
<td
|
|
413
|
-
<td>
|
|
414
|
-
|
|
415
|
-
<
|
|
416
|
-
<td>
|
|
417
|
-
|
|
418
|
-
<
|
|
419
|
-
<td
|
|
420
|
-
|
|
421
|
-
<
|
|
422
|
-
<td>
|
|
423
|
-
<td>
|
|
424
|
-
|
|
425
|
-
<
|
|
426
|
-
|
|
427
|
-
<
|
|
428
|
-
<td>
|
|
429
|
-
<td>
|
|
430
|
-
<td>
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
<
|
|
434
|
-
<td>
|
|
435
|
-
<td
|
|
436
|
-
<td
|
|
437
|
-
<td
|
|
438
|
-
</tr>
|
|
439
|
-
<tr>
|
|
440
|
-
<td
|
|
441
|
-
<td
|
|
442
|
-
<td
|
|
443
|
-
<td
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
<
|
|
447
|
-
<td
|
|
448
|
-
<td
|
|
449
|
-
<td
|
|
450
|
-
|
|
451
|
-
<
|
|
452
|
-
|
|
453
|
-
|
|
339
|
+
<thead>
|
|
340
|
+
<tr>
|
|
341
|
+
<th>Data Structure Typed</th>
|
|
342
|
+
<th>C++ STL</th>
|
|
343
|
+
<th>java.util</th>
|
|
344
|
+
<th>Python collections</th>
|
|
345
|
+
</tr>
|
|
346
|
+
</thead>
|
|
347
|
+
<tbody>
|
|
348
|
+
<tr>
|
|
349
|
+
<td>Heap<E></td>
|
|
350
|
+
<td>priority_queue<T></td>
|
|
351
|
+
<td>PriorityQueue<E></td>
|
|
352
|
+
<td>heapq</td>
|
|
353
|
+
</tr>
|
|
354
|
+
<tr>
|
|
355
|
+
<td>Deque<E></td>
|
|
356
|
+
<td>deque<T></td>
|
|
357
|
+
<td>ArrayDeque<E></td>
|
|
358
|
+
<td>deque</td>
|
|
359
|
+
</tr>
|
|
360
|
+
<tr>
|
|
361
|
+
<td>Queue<E></td>
|
|
362
|
+
<td>queue<T></td>
|
|
363
|
+
<td>Queue<E></td>
|
|
364
|
+
<td>-</td>
|
|
365
|
+
</tr>
|
|
366
|
+
<tr>
|
|
367
|
+
<td>HashMap<K, V></td>
|
|
368
|
+
<td>unordered_map<K, V></td>
|
|
369
|
+
<td>HashMap<K, V></td>
|
|
370
|
+
<td>defaultdict</td>
|
|
371
|
+
</tr>
|
|
372
|
+
<tr>
|
|
373
|
+
<td>DoublyLinkedList<E></td>
|
|
374
|
+
<td>list<T></td>
|
|
375
|
+
<td>LinkedList<E></td>
|
|
376
|
+
<td>-</td>
|
|
377
|
+
</tr>
|
|
378
|
+
<tr>
|
|
379
|
+
<td>SinglyLinkedList<E></td>
|
|
380
|
+
<td>-</td>
|
|
381
|
+
<td>-</td>
|
|
382
|
+
<td>-</td>
|
|
383
|
+
</tr>
|
|
384
|
+
<tr>
|
|
385
|
+
<td>BinaryTree<K, V></td>
|
|
386
|
+
<td>-</td>
|
|
387
|
+
<td>-</td>
|
|
388
|
+
<td>-</td>
|
|
389
|
+
</tr>
|
|
390
|
+
<tr>
|
|
391
|
+
<td>BST<K, V></td>
|
|
392
|
+
<td>-</td>
|
|
393
|
+
<td>-</td>
|
|
394
|
+
<td>-</td>
|
|
395
|
+
</tr>
|
|
396
|
+
<tr>
|
|
397
|
+
<td>RedBlackTree<E></td>
|
|
398
|
+
<td>set<T></td>
|
|
399
|
+
<td>TreeSet<E></td>
|
|
400
|
+
<td>-</td>
|
|
401
|
+
</tr>
|
|
402
|
+
<tr>
|
|
403
|
+
<td>RedBlackTree<K, V></td>
|
|
404
|
+
<td>map<K, V></td>
|
|
405
|
+
<td>TreeMap<K, V></td>
|
|
406
|
+
<td>-</td>
|
|
407
|
+
</tr>
|
|
408
|
+
<tr>
|
|
409
|
+
<td>TreeMultimap<K, V></td>
|
|
410
|
+
<td>multimap<K, V></td>
|
|
411
|
+
<td>-</td>
|
|
412
|
+
<td>-</td>
|
|
413
|
+
</tr>
|
|
414
|
+
<tr>
|
|
415
|
+
<td>-</td>
|
|
416
|
+
<td>multiset<T></td>
|
|
417
|
+
<td>-</td>
|
|
418
|
+
<td>-</td>
|
|
419
|
+
</tr>
|
|
420
|
+
<tr>
|
|
421
|
+
<td>Trie</td>
|
|
422
|
+
<td>-</td>
|
|
423
|
+
<td>-</td>
|
|
424
|
+
<td>-</td>
|
|
425
|
+
</tr>
|
|
426
|
+
<tr>
|
|
427
|
+
<td>DirectedGraph<V, E></td>
|
|
428
|
+
<td>-</td>
|
|
429
|
+
<td>-</td>
|
|
430
|
+
<td>-</td>
|
|
431
|
+
</tr>
|
|
432
|
+
<tr>
|
|
433
|
+
<td>UndirectedGraph<V, E></td>
|
|
434
|
+
<td>-</td>
|
|
435
|
+
<td>-</td>
|
|
436
|
+
<td>-</td>
|
|
437
|
+
</tr>
|
|
438
|
+
<tr>
|
|
439
|
+
<td>PriorityQueue<E></td>
|
|
440
|
+
<td>priority_queue<T></td>
|
|
441
|
+
<td>PriorityQueue<E></td>
|
|
442
|
+
<td>-</td>
|
|
443
|
+
</tr>
|
|
444
|
+
<tr>
|
|
445
|
+
<td>Array<E></td>
|
|
446
|
+
<td>vector<T></td>
|
|
447
|
+
<td>ArrayList<E></td>
|
|
448
|
+
<td>list</td>
|
|
449
|
+
</tr>
|
|
450
|
+
<tr>
|
|
451
|
+
<td>Stack<E></td>
|
|
452
|
+
<td>stack<T></td>
|
|
453
|
+
<td>Stack<E></td>
|
|
454
|
+
<td>-</td>
|
|
455
|
+
</tr>
|
|
456
|
+
<tr>
|
|
457
|
+
<td>Set<E></td>
|
|
458
|
+
<td>-</td>
|
|
459
|
+
<td>HashSet<E></td>
|
|
460
|
+
<td>set</td>
|
|
461
|
+
</tr>
|
|
462
|
+
<tr>
|
|
463
|
+
<td>Map<K, V></td>
|
|
464
|
+
<td>-</td>
|
|
465
|
+
<td>HashMap<K, V></td>
|
|
466
|
+
<td>dict</td>
|
|
467
|
+
</tr>
|
|
468
|
+
<tr>
|
|
469
|
+
<td>-</td>
|
|
470
|
+
<td>unordered_set<T></td>
|
|
471
|
+
<td>HashSet<E></td>
|
|
472
|
+
<td>-</td>
|
|
473
|
+
</tr>
|
|
474
|
+
<tr>
|
|
475
|
+
<td>Map<K, V></td>
|
|
476
|
+
<td>-</td>
|
|
477
|
+
<td>-</td>
|
|
478
|
+
<td>OrderedDict</td>
|
|
479
|
+
</tr>
|
|
480
|
+
<tr>
|
|
481
|
+
<td>-</td>
|
|
482
|
+
<td>unordered_multiset</td>
|
|
483
|
+
<td>-</td>
|
|
484
|
+
<td>Counter</td>
|
|
485
|
+
</tr>
|
|
486
|
+
<tr>
|
|
487
|
+
<td>-</td>
|
|
488
|
+
<td>-</td>
|
|
489
|
+
<td>LinkedHashSet<E></td>
|
|
490
|
+
<td>-</td>
|
|
491
|
+
</tr>
|
|
492
|
+
<tr>
|
|
493
|
+
<td>HashMap<K, V></td>
|
|
494
|
+
<td>-</td>
|
|
495
|
+
<td>LinkedHashMap<K, V></td>
|
|
496
|
+
<td>-</td>
|
|
497
|
+
</tr>
|
|
498
|
+
<tr>
|
|
499
|
+
<td>-</td>
|
|
500
|
+
<td>unordered_multimap<K, V></td>
|
|
501
|
+
<td>-</td>
|
|
502
|
+
<td>-</td>
|
|
503
|
+
</tr>
|
|
504
|
+
<tr>
|
|
505
|
+
<td>-</td>
|
|
506
|
+
<td>bitset<N></td>
|
|
507
|
+
<td>-</td>
|
|
508
|
+
<td>-</td>
|
|
509
|
+
</tr>
|
|
510
|
+
</tbody>
|
|
454
511
|
</table>
|
|
455
512
|
|
|
456
|
-
|
|
513
|
+
## Benchmark
|
|
514
|
+
|
|
515
|
+
[//]: # (No deletion!!! Start of Replace Section)
|
|
516
|
+
<div class="json-to-html-collapse clearfix 0">
|
|
517
|
+
<div class='collapsible level0' ><span class='json-to-html-label'>avl-tree</span></div>
|
|
518
|
+
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>10,000 add randomly</td><td>31.32</td><td>31.93</td><td>3.67e-4</td></tr><tr><td>10,000 add & delete randomly</td><td>70.90</td><td>14.10</td><td>0.00</td></tr><tr><td>10,000 addMany</td><td>40.58</td><td>24.64</td><td>4.87e-4</td></tr><tr><td>10,000 get</td><td>27.31</td><td>36.62</td><td>2.00e-4</td></tr></table></div>
|
|
519
|
+
</div><div class="json-to-html-collapse clearfix 0">
|
|
520
|
+
<div class='collapsible level0' ><span class='json-to-html-label'>binary-tree</span></div>
|
|
521
|
+
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>1,000 add randomly</td><td>12.35</td><td>80.99</td><td>7.17e-5</td></tr><tr><td>1,000 add & delete randomly</td><td>15.98</td><td>62.58</td><td>7.98e-4</td></tr><tr><td>1,000 addMany</td><td>10.96</td><td>91.27</td><td>0.00</td></tr><tr><td>1,000 get</td><td>18.61</td><td>53.73</td><td>0.00</td></tr><tr><td>1,000 dfs</td><td>164.20</td><td>6.09</td><td>0.04</td></tr><tr><td>1,000 bfs</td><td>58.84</td><td>17.00</td><td>0.01</td></tr><tr><td>1,000 morris</td><td>256.66</td><td>3.90</td><td>7.70e-4</td></tr></table></div>
|
|
522
|
+
</div><div class="json-to-html-collapse clearfix 0">
|
|
523
|
+
<div class='collapsible level0' ><span class='json-to-html-label'>bst</span></div>
|
|
524
|
+
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>10,000 add randomly</td><td>31.59</td><td>31.66</td><td>2.74e-4</td></tr><tr><td>10,000 add & delete randomly</td><td>74.56</td><td>13.41</td><td>8.32e-4</td></tr><tr><td>10,000 addMany</td><td>29.16</td><td>34.30</td><td>0.00</td></tr><tr><td>10,000 get</td><td>29.24</td><td>34.21</td><td>0.00</td></tr></table></div>
|
|
525
|
+
</div><div class="json-to-html-collapse clearfix 0">
|
|
526
|
+
<div class='collapsible level0' ><span class='json-to-html-label'>rb-tree</span></div>
|
|
527
|
+
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>100,000 add</td><td>85.85</td><td>11.65</td><td>0.00</td></tr><tr><td>100,000 add & delete randomly</td><td>211.54</td><td>4.73</td><td>0.00</td></tr><tr><td>100,000 getNode</td><td>37.92</td><td>26.37</td><td>1.65e-4</td></tr></table></div>
|
|
528
|
+
</div><div class="json-to-html-collapse clearfix 0">
|
|
529
|
+
<div class='collapsible level0' ><span class='json-to-html-label'>comparison</span></div>
|
|
530
|
+
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>SRC PQ 10,000 add</td><td>0.57</td><td>1748.73</td><td>4.96e-6</td></tr><tr><td>CJS PQ 10,000 add</td><td>0.57</td><td>1746.69</td><td>4.91e-6</td></tr><tr><td>MJS PQ 10,000 add</td><td>0.57</td><td>1749.68</td><td>4.43e-6</td></tr><tr><td>SRC PQ 10,000 add & pop</td><td>3.47</td><td>288.14</td><td>6.38e-4</td></tr><tr><td>CJS PQ 10,000 add & pop</td><td>3.39</td><td>295.36</td><td>3.90e-5</td></tr><tr><td>MJS PQ 10,000 add & pop</td><td>3.37</td><td>297.17</td><td>3.03e-5</td></tr></table></div>
|
|
531
|
+
</div><div class="json-to-html-collapse clearfix 0">
|
|
532
|
+
<div class='collapsible level0' ><span class='json-to-html-label'>directed-graph</span></div>
|
|
533
|
+
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>1,000 addVertex</td><td>0.10</td><td>9534.93</td><td>8.72e-7</td></tr><tr><td>1,000 addEdge</td><td>6.30</td><td>158.67</td><td>0.00</td></tr><tr><td>1,000 getVertex</td><td>0.05</td><td>2.16e+4</td><td>3.03e-7</td></tr><tr><td>1,000 getEdge</td><td>22.31</td><td>44.82</td><td>0.00</td></tr><tr><td>tarjan</td><td>210.90</td><td>4.74</td><td>0.01</td></tr><tr><td>tarjan all</td><td>214.72</td><td>4.66</td><td>0.01</td></tr><tr><td>topologicalSort</td><td>172.52</td><td>5.80</td><td>0.00</td></tr></table></div>
|
|
534
|
+
</div><div class="json-to-html-collapse clearfix 0">
|
|
535
|
+
<div class='collapsible level0' ><span class='json-to-html-label'>hash-map</span></div>
|
|
536
|
+
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>1,000,000 set</td><td>275.88</td><td>3.62</td><td>0.12</td></tr><tr><td>1,000,000 Map set</td><td>211.66</td><td>4.72</td><td>0.01</td></tr><tr><td>1,000,000 Set add</td><td>177.72</td><td>5.63</td><td>0.02</td></tr><tr><td>1,000,000 set & get</td><td>317.60</td><td>3.15</td><td>0.02</td></tr><tr><td>1,000,000 Map set & get</td><td>274.99</td><td>3.64</td><td>0.03</td></tr><tr><td>1,000,000 Set add & has</td><td>172.23</td><td>5.81</td><td>0.02</td></tr><tr><td>1,000,000 ObjKey set & get</td><td>929.40</td><td>1.08</td><td>0.07</td></tr><tr><td>1,000,000 Map ObjKey set & get</td><td>310.02</td><td>3.23</td><td>0.05</td></tr><tr><td>1,000,000 Set ObjKey add & has</td><td>283.28</td><td>3.53</td><td>0.04</td></tr></table></div>
|
|
537
|
+
</div><div class="json-to-html-collapse clearfix 0">
|
|
538
|
+
<div class='collapsible level0' ><span class='json-to-html-label'>heap</span></div>
|
|
539
|
+
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>10,000 add & pop</td><td>5.80</td><td>172.35</td><td>8.78e-5</td></tr><tr><td>10,000 fib add & pop</td><td>357.92</td><td>2.79</td><td>0.00</td></tr></table></div>
|
|
540
|
+
</div><div class="json-to-html-collapse clearfix 0">
|
|
541
|
+
<div class='collapsible level0' ><span class='json-to-html-label'>doubly-linked-list</span></div>
|
|
542
|
+
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>1,000,000 push</td><td>221.57</td><td>4.51</td><td>0.03</td></tr><tr><td>1,000,000 unshift</td><td>229.02</td><td>4.37</td><td>0.07</td></tr><tr><td>1,000,000 unshift & shift</td><td>169.21</td><td>5.91</td><td>0.02</td></tr><tr><td>1,000,000 insertBefore</td><td>314.48</td><td>3.18</td><td>0.07</td></tr></table></div>
|
|
543
|
+
</div><div class="json-to-html-collapse clearfix 0">
|
|
544
|
+
<div class='collapsible level0' ><span class='json-to-html-label'>singly-linked-list</span></div>
|
|
545
|
+
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>10,000 push & pop</td><td>212.98</td><td>4.70</td><td>0.01</td></tr><tr><td>10,000 insertBefore</td><td>250.68</td><td>3.99</td><td>0.01</td></tr></table></div>
|
|
546
|
+
</div><div class="json-to-html-collapse clearfix 0">
|
|
547
|
+
<div class='collapsible level0' ><span class='json-to-html-label'>max-priority-queue</span></div>
|
|
548
|
+
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>10,000 refill & poll</td><td>8.91</td><td>112.29</td><td>2.26e-4</td></tr></table></div>
|
|
549
|
+
</div><div class="json-to-html-collapse clearfix 0">
|
|
550
|
+
<div class='collapsible level0' ><span class='json-to-html-label'>priority-queue</span></div>
|
|
551
|
+
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>100,000 add & pop</td><td>103.59</td><td>9.65</td><td>0.00</td></tr></table></div>
|
|
552
|
+
</div><div class="json-to-html-collapse clearfix 0">
|
|
553
|
+
<div class='collapsible level0' ><span class='json-to-html-label'>deque</span></div>
|
|
554
|
+
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>1,000,000 push</td><td>14.55</td><td>68.72</td><td>6.91e-4</td></tr><tr><td>1,000,000 push & pop</td><td>23.40</td><td>42.73</td><td>5.94e-4</td></tr><tr><td>1,000,000 push & shift</td><td>24.41</td><td>40.97</td><td>1.45e-4</td></tr><tr><td>1,000,000 unshift & shift</td><td>22.56</td><td>44.32</td><td>1.30e-4</td></tr></table></div>
|
|
555
|
+
</div><div class="json-to-html-collapse clearfix 0">
|
|
556
|
+
<div class='collapsible level0' ><span class='json-to-html-label'>queue</span></div>
|
|
557
|
+
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>1,000,000 push</td><td>39.90</td><td>25.07</td><td>0.01</td></tr><tr><td>1,000,000 push & shift</td><td>81.79</td><td>12.23</td><td>0.00</td></tr></table></div>
|
|
558
|
+
</div><div class="json-to-html-collapse clearfix 0">
|
|
559
|
+
<div class='collapsible level0' ><span class='json-to-html-label'>stack</span></div>
|
|
560
|
+
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>1,000,000 push</td><td>37.60</td><td>26.60</td><td>0.00</td></tr><tr><td>1,000,000 push & pop</td><td>47.01</td><td>21.27</td><td>0.00</td></tr></table></div>
|
|
561
|
+
</div><div class="json-to-html-collapse clearfix 0">
|
|
562
|
+
<div class='collapsible level0' ><span class='json-to-html-label'>trie</span></div>
|
|
563
|
+
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>100,000 push</td><td>45.97</td><td>21.76</td><td>0.00</td></tr><tr><td>100,000 getWords</td><td>66.20</td><td>15.11</td><td>0.00</td></tr></table></div>
|
|
564
|
+
</div>
|
|
565
|
+
|
|
566
|
+
[//]: # (No deletion!!! End of Replace Section)
|
|
567
|
+
|
|
568
|
+
## Built-in classic algorithms
|
|
457
569
|
|
|
458
570
|
<table>
|
|
459
|
-
<thead>
|
|
460
|
-
<tr>
|
|
461
|
-
<th>
|
|
462
|
-
<th>
|
|
463
|
-
<th>
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
<
|
|
467
|
-
|
|
468
|
-
</
|
|
469
|
-
<
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
<td>
|
|
473
|
-
|
|
474
|
-
<
|
|
475
|
-
<td>
|
|
476
|
-
<td
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
<td
|
|
480
|
-
|
|
481
|
-
<
|
|
482
|
-
<td>
|
|
483
|
-
<td>
|
|
484
|
-
|
|
485
|
-
</
|
|
486
|
-
<
|
|
487
|
-
|
|
488
|
-
<
|
|
489
|
-
<td>
|
|
490
|
-
<td>1
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
</
|
|
494
|
-
|
|
495
|
-
<
|
|
496
|
-
<td>
|
|
497
|
-
<td>
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
<td
|
|
501
|
-
</tr>
|
|
502
|
-
<tr>
|
|
503
|
-
<td
|
|
504
|
-
<td
|
|
505
|
-
<td>
|
|
506
|
-
|
|
507
|
-
<
|
|
508
|
-
<td>
|
|
509
|
-
</
|
|
510
|
-
<
|
|
511
|
-
|
|
512
|
-
<
|
|
513
|
-
<td>
|
|
514
|
-
<td>
|
|
515
|
-
<td>
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
<
|
|
519
|
-
<td
|
|
520
|
-
<td>
|
|
521
|
-
|
|
522
|
-
<
|
|
523
|
-
<td>
|
|
524
|
-
<td
|
|
525
|
-
</
|
|
526
|
-
|
|
527
|
-
<
|
|
528
|
-
<td>
|
|
529
|
-
<td>
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
<td
|
|
533
|
-
</tr>
|
|
534
|
-
<tr>
|
|
535
|
-
<td
|
|
536
|
-
<td>
|
|
537
|
-
|
|
538
|
-
<td>
|
|
539
|
-
|
|
540
|
-
<
|
|
541
|
-
</
|
|
542
|
-
<
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
<td>
|
|
546
|
-
|
|
547
|
-
<
|
|
548
|
-
<td>
|
|
549
|
-
|
|
550
|
-
|
|
571
|
+
<thead>
|
|
572
|
+
<tr>
|
|
573
|
+
<th>Algorithm</th>
|
|
574
|
+
<th>Function Description</th>
|
|
575
|
+
<th>Iteration Type</th>
|
|
576
|
+
</tr>
|
|
577
|
+
</thead>
|
|
578
|
+
<tbody>
|
|
579
|
+
<tr>
|
|
580
|
+
<td>Binary Tree DFS</td>
|
|
581
|
+
<td>Traverse a binary tree in a depth-first manner, starting from the root node, first visiting the left subtree,
|
|
582
|
+
and then the right subtree, using recursion.
|
|
583
|
+
</td>
|
|
584
|
+
<td>Recursion + Iteration</td>
|
|
585
|
+
</tr>
|
|
586
|
+
<tr>
|
|
587
|
+
<td>Binary Tree BFS</td>
|
|
588
|
+
<td>Traverse a binary tree in a breadth-first manner, starting from the root node, visiting nodes level by level
|
|
589
|
+
from left to right.
|
|
590
|
+
</td>
|
|
591
|
+
<td>Iteration</td>
|
|
592
|
+
</tr>
|
|
593
|
+
<tr>
|
|
594
|
+
<td>Graph DFS</td>
|
|
595
|
+
<td>Traverse a graph in a depth-first manner, starting from a given node, exploring along one path as deeply as
|
|
596
|
+
possible, and backtracking to explore other paths. Used for finding connected components, paths, etc.
|
|
597
|
+
</td>
|
|
598
|
+
<td>Recursion + Iteration</td>
|
|
599
|
+
</tr>
|
|
600
|
+
<tr>
|
|
601
|
+
<td>Binary Tree Morris</td>
|
|
602
|
+
<td>Morris traversal is an in-order traversal algorithm for binary trees with O(1) space complexity. It allows tree
|
|
603
|
+
traversal without additional stack or recursion.
|
|
604
|
+
</td>
|
|
605
|
+
<td>Iteration</td>
|
|
606
|
+
</tr>
|
|
607
|
+
<tr>
|
|
608
|
+
<td>Graph BFS</td>
|
|
609
|
+
<td>Traverse a graph in a breadth-first manner, starting from a given node, first visiting nodes directly connected
|
|
610
|
+
to the starting node, and then expanding level by level. Used for finding shortest paths, etc.
|
|
611
|
+
</td>
|
|
612
|
+
<td>Recursion + Iteration</td>
|
|
613
|
+
</tr>
|
|
614
|
+
<tr>
|
|
615
|
+
<td>Graph Tarjan's Algorithm</td>
|
|
616
|
+
<td>Find strongly connected components in a graph, typically implemented using depth-first search.</td>
|
|
617
|
+
<td>Recursion</td>
|
|
618
|
+
</tr>
|
|
619
|
+
<tr>
|
|
620
|
+
<td>Graph Bellman-Ford Algorithm</td>
|
|
621
|
+
<td>Finding the shortest paths from a single source, can handle negative weight edges</td>
|
|
622
|
+
<td>Iteration</td>
|
|
623
|
+
</tr>
|
|
624
|
+
<tr>
|
|
625
|
+
<td>Graph Dijkstra's Algorithm</td>
|
|
626
|
+
<td>Finding the shortest paths from a single source, cannot handle negative weight edges</td>
|
|
627
|
+
<td>Iteration</td>
|
|
628
|
+
</tr>
|
|
629
|
+
<tr>
|
|
630
|
+
<td>Graph Floyd-Warshall Algorithm</td>
|
|
631
|
+
<td>Finding the shortest paths between all pairs of nodes</td>
|
|
632
|
+
<td>Iteration</td>
|
|
633
|
+
</tr>
|
|
634
|
+
<tr>
|
|
635
|
+
<td>Graph getCycles</td>
|
|
636
|
+
<td>Find all cycles in a graph or detect the presence of cycles.</td>
|
|
637
|
+
<td>Recursion</td>
|
|
638
|
+
</tr>
|
|
639
|
+
<tr>
|
|
640
|
+
<td>Graph getCutVertexes</td>
|
|
641
|
+
<td>Find cut vertices in a graph, which are nodes that, when removed, increase the number of connected components in
|
|
642
|
+
the graph.
|
|
643
|
+
</td>
|
|
644
|
+
<td>Recursion</td>
|
|
645
|
+
</tr>
|
|
646
|
+
<tr>
|
|
647
|
+
<td>Graph getSCCs</td>
|
|
648
|
+
<td>Find strongly connected components in a graph, which are subgraphs where any two nodes can reach each other.
|
|
649
|
+
</td>
|
|
650
|
+
<td>Recursion</td>
|
|
651
|
+
</tr>
|
|
652
|
+
<tr>
|
|
653
|
+
<td>Graph getBridges</td>
|
|
654
|
+
<td>Find bridges in a graph, which are edges that, when removed, increase the number of connected components in the
|
|
655
|
+
graph.
|
|
656
|
+
</td>
|
|
657
|
+
<td>Recursion</td>
|
|
658
|
+
</tr>
|
|
659
|
+
<tr>
|
|
660
|
+
<td>Graph topologicalSort</td>
|
|
661
|
+
<td>Perform topological sorting on a directed acyclic graph (DAG) to find a linear order of nodes such that all
|
|
662
|
+
directed edges go from earlier nodes to later nodes.
|
|
663
|
+
</td>
|
|
664
|
+
<td>Recursion</td>
|
|
665
|
+
</tr>
|
|
666
|
+
</tbody>
|
|
551
667
|
</table>
|
|
552
668
|
|
|
553
|
-
|
|
554
|
-
|
|
669
|
+
## Software Engineering Design Standards
|
|
555
670
|
<table>
|
|
556
|
-
<
|
|
557
|
-
<
|
|
558
|
-
<th>
|
|
559
|
-
|
|
560
|
-
<
|
|
561
|
-
<
|
|
562
|
-
<
|
|
563
|
-
|
|
564
|
-
<
|
|
565
|
-
</
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
<tr>
|
|
569
|
-
<td
|
|
570
|
-
<td>
|
|
571
|
-
|
|
572
|
-
<
|
|
573
|
-
<td>
|
|
574
|
-
<td>
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
<
|
|
578
|
-
<td
|
|
579
|
-
|
|
580
|
-
<
|
|
581
|
-
<td>
|
|
582
|
-
<td>
|
|
583
|
-
|
|
584
|
-
<
|
|
585
|
-
</
|
|
586
|
-
<
|
|
587
|
-
|
|
588
|
-
<
|
|
589
|
-
<td>
|
|
590
|
-
<td>
|
|
591
|
-
|
|
592
|
-
<
|
|
593
|
-
<td
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
<
|
|
597
|
-
<td>
|
|
598
|
-
<td>
|
|
599
|
-
|
|
600
|
-
<td>1</td>
|
|
601
|
-
<td>No</td>
|
|
602
|
-
<td></td>
|
|
603
|
-
</tr>
|
|
604
|
-
<tr>
|
|
605
|
-
<td><strong>Merge sort</strong></td>
|
|
606
|
-
<td>n log(n)</td>
|
|
607
|
-
<td>n log(n)</td>
|
|
608
|
-
<td>n log(n)</td>
|
|
609
|
-
<td>n</td>
|
|
610
|
-
<td>Yes</td>
|
|
611
|
-
<td></td>
|
|
612
|
-
</tr>
|
|
613
|
-
<tr>
|
|
614
|
-
<td><strong>Quick sort</strong></td>
|
|
615
|
-
<td>n log(n)</td>
|
|
616
|
-
<td>n log(n)</td>
|
|
617
|
-
<td>n<sup>2</sup></td>
|
|
618
|
-
<td>log(n)</td>
|
|
619
|
-
<td>No</td>
|
|
620
|
-
<td>Quicksort is usually done in-place with O(log(n)) stack space</td>
|
|
621
|
-
</tr>
|
|
622
|
-
<tr>
|
|
623
|
-
<td><strong>Shell sort</strong></td>
|
|
624
|
-
<td>n log(n)</td>
|
|
625
|
-
<td>depends on gap sequence</td>
|
|
626
|
-
<td>n (log(n))<sup>2</sup></td>
|
|
627
|
-
<td>1</td>
|
|
628
|
-
<td>No</td>
|
|
629
|
-
<td></td>
|
|
630
|
-
</tr>
|
|
631
|
-
<tr>
|
|
632
|
-
<td><strong>Counting sort</strong></td>
|
|
633
|
-
<td>n + r</td>
|
|
634
|
-
<td>n + r</td>
|
|
635
|
-
<td>n + r</td>
|
|
636
|
-
<td>n + r</td>
|
|
637
|
-
<td>Yes</td>
|
|
638
|
-
<td>r - biggest number in array</td>
|
|
639
|
-
</tr>
|
|
640
|
-
<tr>
|
|
641
|
-
<td><strong>Radix sort</strong></td>
|
|
642
|
-
<td>n * k</td>
|
|
643
|
-
<td>n * k</td>
|
|
644
|
-
<td>n * k</td>
|
|
645
|
-
<td>n + k</td>
|
|
646
|
-
<td>Yes</td>
|
|
647
|
-
<td>k - length of longest key</td>
|
|
648
|
-
</tr>
|
|
649
|
-
</tbody>
|
|
671
|
+
<tr>
|
|
672
|
+
<th>Principle</th>
|
|
673
|
+
<th>Description</th>
|
|
674
|
+
</tr>
|
|
675
|
+
<tr>
|
|
676
|
+
<td>Practicality</td>
|
|
677
|
+
<td>Follows ES6 and ESNext standards, offering unified and considerate optional parameters, and simplifies method names.</td>
|
|
678
|
+
</tr>
|
|
679
|
+
<tr>
|
|
680
|
+
<td>Extensibility</td>
|
|
681
|
+
<td>Adheres to OOP (Object-Oriented Programming) principles, allowing inheritance for all data structures.</td>
|
|
682
|
+
</tr>
|
|
683
|
+
<tr>
|
|
684
|
+
<td>Modularization</td>
|
|
685
|
+
<td>Includes data structure modularization and independent NPM packages.</td>
|
|
686
|
+
</tr>
|
|
687
|
+
<tr>
|
|
688
|
+
<td>Efficiency</td>
|
|
689
|
+
<td>All methods provide time and space complexity, comparable to native JS performance.</td>
|
|
690
|
+
</tr>
|
|
691
|
+
<tr>
|
|
692
|
+
<td>Maintainability</td>
|
|
693
|
+
<td>Follows open-source community development standards, complete documentation, continuous integration, and adheres to TDD (Test-Driven Development) patterns.</td>
|
|
694
|
+
</tr>
|
|
695
|
+
<tr>
|
|
696
|
+
<td>Testability</td>
|
|
697
|
+
<td>Automated and customized unit testing, performance testing, and integration testing.</td>
|
|
698
|
+
</tr>
|
|
699
|
+
<tr>
|
|
700
|
+
<td>Portability</td>
|
|
701
|
+
<td>Plans for porting to Java, Python, and C++, currently achieved to 80%.</td>
|
|
702
|
+
</tr>
|
|
703
|
+
<tr>
|
|
704
|
+
<td>Reusability</td>
|
|
705
|
+
<td>Fully decoupled, minimized side effects, and adheres to OOP.</td>
|
|
706
|
+
</tr>
|
|
707
|
+
<tr>
|
|
708
|
+
<td>Security</td>
|
|
709
|
+
<td>Carefully designed security for member variables and methods. Read-write separation. Data structure software does not need to consider other security aspects.</td>
|
|
710
|
+
</tr>
|
|
711
|
+
<tr>
|
|
712
|
+
<td>Scalability</td>
|
|
713
|
+
<td>Data structure software does not involve load issues.</td>
|
|
714
|
+
</tr>
|
|
650
715
|
</table>
|
|
651
716
|
|
|
652
|
-

|
|
653
|
-
|
|
654
|
-

|
|
655
|
-
|
|
656
|
-

|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
717
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "graph-typed",
|
|
3
|
-
"version": "1.47.
|
|
3
|
+
"version": "1.47.4",
|
|
4
4
|
"description": "Graph. Javascript & Typescript Data Structure.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -136,6 +136,6 @@
|
|
|
136
136
|
"typescript": "^4.9.5"
|
|
137
137
|
},
|
|
138
138
|
"dependencies": {
|
|
139
|
-
"data-structure-typed": "^1.47.
|
|
139
|
+
"data-structure-typed": "^1.47.4"
|
|
140
140
|
}
|
|
141
141
|
}
|