data-structure-typed 1.33.6 → 1.33.8
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/.github/workflows/ci.yml +1 -0
- package/CHANGELOG.md +1 -1
- package/README.md +42 -38
- package/coverage/coverage-final.json +64 -63
- package/coverage/coverage-summary.json +8 -7
- package/dist/data-structures/binary-tree/segment-tree.js +24 -6
- package/dist/data-structures/binary-tree/segment-tree.js.map +1 -1
- package/dist/data-structures/hash/hash-map.js +306 -0
- package/dist/data-structures/hash/hash-map.js.map +1 -0
- package/dist/data-structures/hash/hash-table.js +128 -38
- package/dist/data-structures/hash/hash-table.js.map +1 -1
- package/dist/data-structures/hash/index.js +1 -0
- package/dist/data-structures/hash/index.js.map +1 -1
- package/dist/data-structures/linked-list/skip-linked-list.js +122 -5
- package/dist/data-structures/linked-list/skip-linked-list.js.map +1 -1
- package/dist/types/data-structures/hash.js +3 -0
- package/dist/types/data-structures/hash.js.map +1 -0
- package/dist/types/data-structures/index.js +1 -0
- package/dist/types/data-structures/index.js.map +1 -1
- package/docs/index.html +35 -37
- package/docs/modules.html +10 -4
- package/lib/data-structures/binary-tree/segment-tree.d.ts +4 -4
- package/lib/data-structures/binary-tree/segment-tree.js +30 -14
- package/lib/data-structures/hash/hash-map.d.ts +56 -0
- package/lib/data-structures/hash/hash-map.js +167 -0
- package/lib/data-structures/hash/hash-table.d.ts +67 -23
- package/lib/data-structures/hash/hash-table.js +154 -52
- package/lib/data-structures/hash/index.d.ts +1 -0
- package/lib/data-structures/hash/index.js +1 -0
- package/lib/data-structures/linked-list/skip-linked-list.d.ts +60 -1
- package/lib/data-structures/linked-list/skip-linked-list.js +136 -1
- package/lib/types/data-structures/hash.d.ts +1 -0
- package/lib/types/data-structures/hash.js +1 -0
- package/lib/types/data-structures/index.d.ts +1 -0
- package/lib/types/data-structures/index.js +1 -0
- package/package.json +22 -22
- package/src/data-structures/binary-tree/segment-tree.ts +32 -14
- package/src/data-structures/hash/hash-map.ts +203 -0
- package/src/data-structures/hash/hash-table.ts +176 -56
- package/src/data-structures/hash/index.ts +1 -0
- package/src/data-structures/linked-list/skip-linked-list.ts +166 -1
- package/src/types/data-structures/hash.ts +1 -0
- package/src/types/data-structures/index.ts +1 -0
- package/test/integration/index.html +26 -18
- package/test/unit/data-structures/binary-tree/segment-tree.test.ts +50 -0
- package/test/unit/data-structures/hash/hash-map.test.ts +104 -0
- package/test/unit/data-structures/hash/hash-table.test.ts +97 -10
- package/test/unit/data-structures/linked-list/skip-list.test.ts +55 -0
- package/umd/bundle.min.js +1 -1
- package/umd/bundle.min.js.map +1 -1
- package/tsconfig.prod.json +0 -25
package/.github/workflows/ci.yml
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -8,7 +8,7 @@ All notable changes to this project will be documented in this file.
|
|
|
8
8
|
- [Semantic Versioning](https://semver.org/spec/v2.0.0.html)
|
|
9
9
|
- [`auto-changelog`](https://github.com/CookPete/auto-changelog)
|
|
10
10
|
|
|
11
|
-
## [v1.33.
|
|
11
|
+
## [v1.33.7](https://github.com/zrwusa/data-structure-typed/compare/v1.33.4...main) (upcoming)
|
|
12
12
|
|
|
13
13
|
## [v1.33.4](https://github.com/zrwusa/data-structure-typed/compare/v1.33.3...v1.33.4) (26 September 2023)
|
|
14
14
|
|
package/README.md
CHANGED
|
@@ -2,17 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
Data Structures of Javascript & TypeScript.
|
|
4
4
|
|
|
5
|
-
Do you envy
|
|
5
|
+
Do you envy C++ with [std](), Python with [collections](), and Java with [java.util]() ? Well, no need to envy anymore! JavaScript and TypeScript now have [data-structure-typed]().
|
|
6
6
|
|
|
7
7
|
Now you can use this library in Node.js and browser environments in CommonJS(require export.modules = ), ESModule(import export), Typescript(import export), UMD(var Queue = dataStructureTyped.Queue)
|
|
8
8
|
|
|
9
|
+
The size after packaging is 69 kB.
|
|
10
|
+
|
|
9
11
|

|
|
10
12
|

|
|
11
13
|

|
|
12
|
-

|
|
13
14
|

|
|
14
15
|

|
|
15
16
|
|
|
17
|
+
[//]: # ()
|
|
18
|
+
|
|
19
|
+
[//]: # ()
|
|
20
|
+
|
|
21
|
+
[//]: # ()
|
|
22
|
+
|
|
23
|
+
[//]: # ()
|
|
24
|
+
|
|
25
|
+
|
|
16
26
|
## Built-in classic algorithms
|
|
17
27
|
|
|
18
28
|
DFS(Depth-First Search), DFSIterative, BFS(Breadth-First Search), morris, Bellman-Ford Algorithm, Dijkstra's Algorithm,
|
|
@@ -23,7 +33,7 @@ Floyd-Warshall Algorithm, Tarjan's Algorithm.
|
|
|
23
33
|
### npm
|
|
24
34
|
|
|
25
35
|
```bash
|
|
26
|
-
npm i data-structure-typed
|
|
36
|
+
npm i data-structure-typed
|
|
27
37
|
```
|
|
28
38
|
|
|
29
39
|
### yarn
|
|
@@ -32,6 +42,14 @@ npm i data-structure-typed --save
|
|
|
32
42
|
yarn add data-structure-typed
|
|
33
43
|
```
|
|
34
44
|
|
|
45
|
+
```js
|
|
46
|
+
import {
|
|
47
|
+
BinaryTree, Graph, Queue, Stack, PriorityQueue, BST, Trie, DoublyLinkedList,
|
|
48
|
+
AVLTree, MinHeap, SinglyLinkedList, DirectedGraph, TreeMultiset,
|
|
49
|
+
DirectedVertex, AVLTreeNode
|
|
50
|
+
} from 'data-structure-typed';
|
|
51
|
+
```
|
|
52
|
+
|
|
35
53
|
### CDN
|
|
36
54
|
|
|
37
55
|
```html
|
|
@@ -40,18 +58,11 @@ yarn add data-structure-typed
|
|
|
40
58
|
```
|
|
41
59
|
|
|
42
60
|
```js
|
|
43
|
-
const {
|
|
61
|
+
const {Heap} = dataStructureTyped;
|
|
44
62
|
const {
|
|
45
|
-
|
|
46
|
-
MinHeap,
|
|
47
|
-
|
|
48
|
-
Stack,
|
|
49
|
-
AVLTreeNode,
|
|
50
|
-
BST,
|
|
51
|
-
Trie,
|
|
52
|
-
DirectedGraph,
|
|
53
|
-
DirectedVertex,
|
|
54
|
-
TreeMultiset
|
|
63
|
+
BinaryTree, Graph, Queue, Stack, PriorityQueue, BST, Trie, DoublyLinkedList,
|
|
64
|
+
AVLTree, MinHeap, SinglyLinkedList, DirectedGraph, TreeMultiset,
|
|
65
|
+
DirectedVertex, AVLTreeNode
|
|
55
66
|
} = dataStructureTyped;
|
|
56
67
|
```
|
|
57
68
|
|
|
@@ -441,24 +452,17 @@ Array.from(dijkstraResult?.seen ?? []).map(vertex => vertex.id) // ['A', 'B', 'D
|
|
|
441
452
|
<tr>
|
|
442
453
|
<td>Set</td>
|
|
443
454
|
<td>std::set<T></td>
|
|
444
|
-
<td>Set</td>
|
|
455
|
+
<td>Set<E></td>
|
|
445
456
|
<td>HashSet<E></td>
|
|
446
457
|
<td>set</td>
|
|
447
458
|
</tr>
|
|
448
459
|
<tr>
|
|
449
460
|
<td>Map</td>
|
|
450
461
|
<td>std::map<K, V></td>
|
|
451
|
-
<td>Map
|
|
462
|
+
<td>Map<K, V></td>
|
|
452
463
|
<td>HashMap<K, V></td>
|
|
453
464
|
<td>dict</td>
|
|
454
465
|
</tr>
|
|
455
|
-
<tr>
|
|
456
|
-
<td>Unordered Map</td>
|
|
457
|
-
<td>std::unordered_map<K, V></td>
|
|
458
|
-
<td>N/A</td>
|
|
459
|
-
<td>HashMap<K, V></td>
|
|
460
|
-
<td>defaultdict</td>
|
|
461
|
-
</tr>
|
|
462
466
|
<tr>
|
|
463
467
|
<td>Unordered Set</td>
|
|
464
468
|
<td>std::unordered_set<T></td>
|
|
@@ -466,24 +470,31 @@ Array.from(dijkstraResult?.seen ?? []).map(vertex => vertex.id) // ['A', 'B', 'D
|
|
|
466
470
|
<td>HashSet<E></td>
|
|
467
471
|
<td>N/A</td>
|
|
468
472
|
</tr>
|
|
473
|
+
<tr>
|
|
474
|
+
<td>Unordered Map</td>
|
|
475
|
+
<td>std::unordered_map<K, V></td>
|
|
476
|
+
<td>HashMap<K, V></td>
|
|
477
|
+
<td>HashMap<K, V></td>
|
|
478
|
+
<td>defaultdict</td>
|
|
479
|
+
</tr>
|
|
469
480
|
<tr>
|
|
470
481
|
<td>Queue</td>
|
|
471
482
|
<td>std::queue<T></td>
|
|
472
|
-
<td>Queue
|
|
483
|
+
<td>Queue<E></td>
|
|
473
484
|
<td>Queue<E></td>
|
|
474
485
|
<td>N/A</td>
|
|
475
486
|
</tr>
|
|
476
487
|
<tr>
|
|
477
488
|
<td>Priority Queue</td>
|
|
478
489
|
<td>std::priority_queue<T></td>
|
|
479
|
-
<td>PriorityQueue
|
|
490
|
+
<td>PriorityQueue<E></td>
|
|
480
491
|
<td>PriorityQueue<E></td>
|
|
481
492
|
<td>N/A</td>
|
|
482
493
|
</tr>
|
|
483
494
|
<tr>
|
|
484
495
|
<td>Stack</td>
|
|
485
496
|
<td>std::stack<T></td>
|
|
486
|
-
<td>Stack
|
|
497
|
+
<td>Stack<E></td>
|
|
487
498
|
<td>Stack<E></td>
|
|
488
499
|
<td>N/A</td>
|
|
489
500
|
</tr>
|
|
@@ -497,7 +508,7 @@ Array.from(dijkstraResult?.seen ?? []).map(vertex => vertex.id) // ['A', 'B', 'D
|
|
|
497
508
|
<tr>
|
|
498
509
|
<td>Deque</td>
|
|
499
510
|
<td>std::deque<T></td>
|
|
500
|
-
<td>Deque
|
|
511
|
+
<td>Deque<E></td>
|
|
501
512
|
<td>N/A</td>
|
|
502
513
|
<td>N/A</td>
|
|
503
514
|
</tr>
|
|
@@ -525,17 +536,10 @@ Array.from(dijkstraResult?.seen ?? []).map(vertex => vertex.id) // ['A', 'B', 'D
|
|
|
525
536
|
<tr>
|
|
526
537
|
<td>Ordered Dictionary</td>
|
|
527
538
|
<td>N/A</td>
|
|
528
|
-
<td>Map
|
|
539
|
+
<td>Map<K, V></td>
|
|
529
540
|
<td>N/A</td>
|
|
530
541
|
<td>OrderedDict</td>
|
|
531
542
|
</tr>
|
|
532
|
-
<tr>
|
|
533
|
-
<td>Double-Ended Queue (Deque)</td>
|
|
534
|
-
<td>std::deque<T></td>
|
|
535
|
-
<td>Deque</td>
|
|
536
|
-
<td>N/A</td>
|
|
537
|
-
<td>N/A</td>
|
|
538
|
-
</tr>
|
|
539
543
|
<tr>
|
|
540
544
|
<td>Linked Hash Set</td>
|
|
541
545
|
<td>N/A</td>
|
|
@@ -553,21 +557,21 @@ Array.from(dijkstraResult?.seen ?? []).map(vertex => vertex.id) // ['A', 'B', 'D
|
|
|
553
557
|
<tr>
|
|
554
558
|
<td>Sorted Set</td>
|
|
555
559
|
<td>N/A</td>
|
|
556
|
-
<td>AVLTree
|
|
560
|
+
<td>AVLTree</td>
|
|
557
561
|
<td>TreeSet<E></td>
|
|
558
562
|
<td>N/A</td>
|
|
559
563
|
</tr>
|
|
560
564
|
<tr>
|
|
561
565
|
<td>Sorted Map</td>
|
|
562
566
|
<td>N/A</td>
|
|
563
|
-
<td>AVLTree
|
|
567
|
+
<td>AVLTree</td>
|
|
564
568
|
<td>TreeMap<K, V></td>
|
|
565
569
|
<td>N/A</td>
|
|
566
570
|
</tr>
|
|
567
571
|
<tr>
|
|
568
572
|
<td>Tree Set</td>
|
|
569
573
|
<td>std::set</td>
|
|
570
|
-
<td>AVLTree
|
|
574
|
+
<td>AVLTree</td>
|
|
571
575
|
<td>TreeSet<E></td>
|
|
572
576
|
<td>N/A</td>
|
|
573
577
|
</tr>
|