data-structure-typed 2.4.4 → 2.4.5
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/CHANGELOG.md +22 -1
- package/README.md +24 -1
- package/dist/cjs/index.cjs +459 -132
- package/dist/cjs-legacy/index.cjs +459 -130
- package/dist/esm/index.mjs +459 -133
- package/dist/esm-legacy/index.mjs +459 -131
- package/dist/types/common/error.d.ts +23 -0
- package/dist/types/common/index.d.ts +1 -0
- package/dist/types/data-structures/binary-tree/binary-tree.d.ts +10 -0
- package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +7 -1
- package/dist/types/data-structures/graph/abstract-graph.d.ts +44 -0
- package/dist/types/data-structures/graph/directed-graph.d.ts +1 -0
- package/dist/types/data-structures/graph/undirected-graph.d.ts +14 -0
- package/dist/types/data-structures/queue/deque.d.ts +41 -1
- package/dist/types/types/data-structures/queue/deque.d.ts +6 -0
- package/dist/umd/data-structure-typed.js +458 -129
- package/dist/umd/data-structure-typed.min.js +4 -2
- package/package.json +2 -2
- package/src/common/error.ts +60 -0
- package/src/common/index.ts +2 -0
- package/src/data-structures/base/iterable-element-base.ts +3 -2
- package/src/data-structures/binary-tree/binary-indexed-tree.ts +6 -5
- package/src/data-structures/binary-tree/binary-tree.ts +113 -42
- package/src/data-structures/binary-tree/bst.ts +11 -3
- package/src/data-structures/binary-tree/red-black-tree.ts +20 -0
- package/src/data-structures/binary-tree/tree-map.ts +8 -7
- package/src/data-structures/binary-tree/tree-multi-map.ts +4 -4
- package/src/data-structures/binary-tree/tree-multi-set.ts +5 -4
- package/src/data-structures/binary-tree/tree-set.ts +7 -6
- package/src/data-structures/graph/abstract-graph.ts +106 -1
- package/src/data-structures/graph/directed-graph.ts +4 -0
- package/src/data-structures/graph/undirected-graph.ts +95 -0
- package/src/data-structures/hash/hash-map.ts +13 -2
- package/src/data-structures/heap/heap.ts +4 -3
- package/src/data-structures/heap/max-heap.ts +2 -3
- package/src/data-structures/matrix/matrix.ts +9 -10
- package/src/data-structures/priority-queue/max-priority-queue.ts +2 -3
- package/src/data-structures/queue/deque.ts +71 -3
- package/src/data-structures/trie/trie.ts +2 -1
- package/src/types/data-structures/queue/deque.ts +7 -0
- package/src/utils/utils.ts +4 -2
package/CHANGELOG.md
CHANGED
|
@@ -8,7 +8,28 @@ 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
|
-
## [v2.4.
|
|
11
|
+
## [v2.4.5](https://github.com/zrwusa/data-structure-typed/compare/v2.4.3...main) (upcoming)
|
|
12
|
+
|
|
13
|
+
### Changes
|
|
14
|
+
|
|
15
|
+
- fix(binary-tree): null nodes no longer count toward size [`#70`](https://github.com/zrwusa/data-structure-typed/pull/70)
|
|
16
|
+
- feat(graph): add biconnected components and cycle detection for undirected graph [`#77`](https://github.com/zrwusa/data-structure-typed/pull/77)
|
|
17
|
+
- fix(rbt): override perfectlyBalance to preserve RBT invariants [`#79`](https://github.com/zrwusa/data-structure-typed/pull/79)
|
|
18
|
+
- feat(bst): support Date keys in default comparator [`#107`](https://github.com/zrwusa/data-structure-typed/pull/107)
|
|
19
|
+
- refactor(binary-tree): iterative _displayAux to prevent stack overflow on deep trees [`#104`](https://github.com/zrwusa/data-structure-typed/pull/104)
|
|
20
|
+
- fix(binary-tree): leaves() iterative mode uses DFS stack to match recursive order [`#102`](https://github.com/zrwusa/data-structure-typed/pull/102)
|
|
21
|
+
- refactor: migrate all throw sites to ERR message templates [`#130`](https://github.com/zrwusa/data-structure-typed/pull/130)
|
|
22
|
+
- refactor: lightweight centralized error messages via ERR templates [`#130`](https://github.com/zrwusa/data-structure-typed/pull/130)
|
|
23
|
+
- feat: centralized error handling with DSTError/DSTRangeError/DSTTypeError [`#130`](https://github.com/zrwusa/data-structure-typed/pull/130)
|
|
24
|
+
- refactor(deque): improve auto-compact with counter + element-based ratio [`#92`](https://github.com/zrwusa/data-structure-typed/pull/92)
|
|
25
|
+
- perf(deque): optimize auto-compact with counter-based checking and element ratio [`#92`](https://github.com/zrwusa/data-structure-typed/pull/92)
|
|
26
|
+
- feat(deque): add compact() method and autoCompactRatio option [`#92`](https://github.com/zrwusa/data-structure-typed/pull/92)
|
|
27
|
+
- fix(deque): add constructor overloads for better type inference [`#97`](https://github.com/zrwusa/data-structure-typed/pull/97)
|
|
28
|
+
- test(graph): add edge case tests for visual output [`#113`](https://github.com/zrwusa/data-structure-typed/pull/113)
|
|
29
|
+
- test(graph): add visual output tests for DirectedGraph and UndirectedGraph [`#113`](https://github.com/zrwusa/data-structure-typed/pull/113)
|
|
30
|
+
- feat(graph): add print, toVisual, and toDot methods for all graphs [`#113`](https://github.com/zrwusa/data-structure-typed/pull/113)
|
|
31
|
+
- fix(hash-map): deleteAt/deleteWhere now removes entry from hash table [`#99`](https://github.com/zrwusa/data-structure-typed/pull/99)
|
|
32
|
+
- fix(deque): shrinkToFit now updates _bucketCount and handles single-bucket case [`#98`](https://github.com/zrwusa/data-structure-typed/pull/98)
|
|
12
33
|
|
|
13
34
|
## [v2.4.3](https://github.com/zrwusa/data-structure-typed/compare/v2.2.3...v2.4.3) (3 March 2026)
|
|
14
35
|
|
package/README.md
CHANGED
|
@@ -130,7 +130,30 @@ for (let i = 0; i < 100000; i++) {
|
|
|
130
130
|
|
|
131
131
|
- **Tree-shakable** ESM / CJS / legacy builds
|
|
132
132
|
|
|
133
|
-
|
|
133
|
+
[//]: # (No deletion!!! Start of README Performance Section)
|
|
134
|
+
|
|
135
|
+
| Data Structure | Test Case | DST (ms) | Native (ms) | C++ (ms) | js-sdsl (ms) |
|
|
136
|
+
|----------------|-----------|----------|-------------|----------|---------------|
|
|
137
|
+
| Queue | 1M push | 26.93 | 23.83 | 1.70 | 27.59 |
|
|
138
|
+
| Deque | 1M push | 9.77 | 26.81 | 1.76 | 7.79 |
|
|
139
|
+
| DoublyLinkedList | 100k push | 5.70 | 2.40 | 5.70 | 1.90 |
|
|
140
|
+
| SinglyLinkedList | 100K unshift & shift | 3.77 | 1958.39 | 4.80 | - |
|
|
141
|
+
| PriorityQueue | 100K add | 4.00 | - | 1.05 | 4.96 |
|
|
142
|
+
| TreeSet | 1M add | 962.76 | - | 462.00 | 640.31 |
|
|
143
|
+
| TreeMap | 1M set | 996.95 | - | 512.00 | 624.82 |
|
|
144
|
+
| TreeMultiSet | 1M add (TreeMultiSet expanded iteration) | 218.78 | - | 752.00 | - |
|
|
145
|
+
| TreeMultiMap | 1M add (TreeMultiMap bucketed) | 387.80 | - | 731.00 | - |
|
|
146
|
+
| RedBlackTree | 1M get | 108.02 | - | 52.97 | - |
|
|
147
|
+
| BST | 10K add randomly | 5.50 | - | - | - |
|
|
148
|
+
| BinaryTree | 1K add randomly | 9.77 | - | - | - |
|
|
149
|
+
| HashMap | 1M set | 146.17 | 144.83 | 76.26 | 94.16 |
|
|
150
|
+
| Trie | 100K add | 141.10 | - | - | - |
|
|
151
|
+
| DirectedGraph | 1K addVertex | 0.05 | - | - | - |
|
|
152
|
+
| Stack | 1M push | 46.38 | 30.28 | 1.65 | 32.38 |
|
|
153
|
+
|
|
154
|
+
[//]: # (No deletion!!! End of README Performance Section)
|
|
155
|
+
|
|
156
|
+
📊 [Full benchmarks →](./docs/PERFORMANCE.md) | [Interactive report →](./docs/benchmark.html)
|
|
134
157
|
|
|
135
158
|
---
|
|
136
159
|
|