typescript-dsa-stl 1.4.1 → 2.0.1

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 CHANGED
@@ -1,249 +1,354 @@
1
- # TypeScript_DSA
2
-
3
- **This is the GitHub repository** for the npm package **[typescript-dsa-stl](https://www.npmjs.com/package/typescript-dsa-stl)**.
4
-
5
- STL-style data structures and algorithms for TypeScript: **Vector**, **Stack**, **Queue**, **List**, **PriorityQueue**, **OrderedMap** (Map), **UnorderedMap**, **OrderedSet** (Set), **UnorderedSet**, **OrderedMultiMap**, **OrderedMultiSet**, and algorithms (`sort`, `binarySearch`, `lowerBound`, `min`, `max`, etc.). Install from npm to use in your project; this repo holds the source code.
6
-
7
- ---
8
-
9
- ## Install
10
-
11
- ```bash
12
- npm install typescript-dsa-stl
13
- ```
14
-
15
- ---
16
-
17
- ## Quick start
18
-
19
- ```ts
20
- import {
21
- Vector,
22
- Stack,
23
- Queue,
24
- List,
25
- PriorityQueue,
26
- OrderedMap,
27
- UnorderedMap,
28
- OrderedSet,
29
- UnorderedSet,
30
- OrderedMultiMap,
31
- OrderedMultiSet,
32
- sort,
33
- find,
34
- binarySearch,
35
- min,
36
- max,
37
- clamp,
38
- range,
39
- } from 'typescript-dsa-stl';
40
-
41
- // Collections
42
- const vec = new Vector<number>([1, 2, 3]);
43
- vec.push(4);
44
- console.log(vec.back()); // 4
45
-
46
- const stack = new Stack<string>();
47
- stack.push('a');
48
- stack.push('b');
49
- console.log(stack.top()); // 'b'
50
-
51
- const queue = new Queue<number>();
52
- queue.enqueue(1);
53
- queue.enqueue(2);
54
- console.log(queue.front()); // 1
55
-
56
- const list = new List<number>();
57
- list.pushBack(10);
58
- const node = list.pushBack(20);
59
- list.insertBefore(node, 15);
60
- console.log(list.toArray()); // [10, 15, 20]
61
-
62
- // PriorityQueue (max-heap by default)
63
- const pq = new PriorityQueue<number>();
64
- pq.push(3); pq.push(1); pq.push(4);
65
- console.log(pq.top()); // 4
66
- pq.pop();
67
-
68
- // OrderedMap (keys sorted), UnorderedMap (hash)
69
- const map = new UnorderedMap<string, number>();
70
- map.set('a', 1); map.set('b', 2);
71
- console.log(map.get('a')); // 1
72
-
73
- // OrderedSet (sorted unique), UnorderedSet (hash)
74
- const set = new UnorderedSet<number>([1, 2, 2, 3]);
75
- console.log(set.size); // 3
76
-
77
- // OrderedMultiSet (sorted, duplicates allowed)
78
- const multiSet = new OrderedMultiSet<number>();
79
- multiSet.add(3); multiSet.add(1); multiSet.add(2); multiSet.add(2);
80
- console.log(multiSet.toArray()); // [1, 2, 2, 3]
81
- console.log(multiSet.count(2)); // 2
82
-
83
- // OrderedMultiMap (one key → multiple values, keys sorted)
84
- const multiMap = new OrderedMultiMap<string, number>();
85
- multiMap.set('scores', 90); multiMap.set('scores', 85); multiMap.set('scores', 95);
86
- console.log(multiMap.getAll('scores')); // [90, 85, 95]
87
-
88
- // Algorithms (work on arrays and iterables)
89
- const arr = [3, 1, 4, 1, 5];
90
- sort(arr); // [1, 1, 3, 4, 5]
91
- find(arr, (n) => n > 3); // 4
92
- min(arr); // 1
93
- max(arr); // 5
94
-
95
- const sorted = [1, 2, 4, 4, 5];
96
- binarySearch(sorted, 4); // 2
97
- lowerBound(sorted, 4); // 2
98
- upperBound(sorted, 4); // 4
99
-
100
- // Utils
101
- clamp(42, 0, 10); // 10
102
- range(0, 5); // [0, 1, 2, 3, 4]
103
- ```
104
-
105
- ### 2D and 3D vectors (like C++ `vector<vector<int>>`)
106
-
107
- `Vector<T>` is generic, so you can nest it for 2D/3D grids:
108
-
109
- | C++ | TypeScript |
110
- |-----|------------|
111
- | `vector<int>` | `Vector<number>` |
112
- | `vector<vector<int>>` | `Vector<Vector<number>>` |
113
- | `vector<vector<vector<int>>>` | `Vector<Vector<Vector<number>>>` |
114
-
115
- **2D example:**
116
-
117
- ```ts
118
- import { Vector } from 'typescript-dsa-stl';
119
-
120
- const grid = new Vector<Vector<number>>();
121
-
122
- const row0 = new Vector<number>([1, 2, 3]);
123
- const row1 = new Vector<number>([4, 5, 6]);
124
- grid.push(row0);
125
- grid.push(row1);
126
-
127
- grid.at(0).at(1); // 2 (first row, second column)
128
- grid.at(1).at(0); // 4 (second row, first column)
129
-
130
- grid.at(0).set(1, 99);
131
- grid.at(0).push(10);
132
- ```
133
-
134
- **3D example:**
135
-
136
- ```ts
137
- const cube = new Vector<Vector<Vector<number>>>();
138
-
139
- const layer0 = new Vector<Vector<number>>();
140
- layer0.push(new Vector<number>([1, 2]));
141
- layer0.push(new Vector<number>([3, 4]));
142
- cube.push(layer0);
143
-
144
- cube.at(0).at(1).at(0); // 3 (layer 0, row 1, col 0)
145
- ```
146
-
147
- ---
148
-
149
- ## API overview
150
-
151
- | Module | Exports |
152
- |--------|--------|
153
- | **Collections** | `Vector`, `Stack`, `Queue`, `List`, `ListNode`, `PriorityQueue`, `OrderedMap`, `UnorderedMap`, `OrderedSet`, `UnorderedSet`, `OrderedMultiMap`, `OrderedMultiSet` |
154
- | **Algorithms** | `sort`, `find`, `findIndex`, `transform`, `filter`, `reduce`, `reverse`, `unique`, `binarySearch`, `lowerBound`, `upperBound`, `min`, `max`, `partition` |
155
- | **Utils** | `clamp`, `range`, `noop`, `identity`, `swap` |
156
- | **Types** | `Comparator`, `Predicate`, `UnaryFn`, `Reducer`, `IterableLike`, `toArray` |
157
-
158
- ### Subpath imports (tree-shaking)
159
-
160
- ```ts
161
- import { Vector, Stack } from 'typescript-dsa-stl/collections';
162
- import { sort, binarySearch } from 'typescript-dsa-stl/algorithms';
163
- import { clamp, range } from 'typescript-dsa-stl/utils';
164
- import type { Comparator } from 'typescript-dsa-stl/types';
165
- ```
166
-
167
- ---
168
-
169
- ## Data structures
170
-
171
- | Structure | Access | Insert end | Insert middle | Remove end | Remove middle |
172
- |-----------|--------|------------|---------------|------------|---------------|
173
- | **Vector** | O(1) | O(1)* | O(n) | O(1) | O(n) |
174
- | **Stack** | — | O(1) | | O(1) | — |
175
- | **Queue** | — | O(1)* | — | O(1)* | — |
176
- | **List** | O(n) | O(1) | O(1)** | O(1) | O(1)** |
177
- | **PriorityQueue** | — | O(log n) | — | O(log n) | — |
178
- | **OrderedMap** (Map) | O(log n) get | O(log n) set | — | O(log n) delete | — |
179
- | **UnorderedMap** | O(1)* get/set | O(1)* | — | O(1)* delete | — |
180
- | **OrderedSet** (Set) | O(log n) has | O(log n) add | — | O(log n) delete | — |
181
- | **UnorderedSet** | O(1)* has/add | O(1)* | — | O(1)* delete | — |
182
- | **OrderedMultiMap** | O(log n) get | O(log n) set | — | O(log n) delete | — |
183
- | **OrderedMultiSet** | O(log n) has/count | O(log n) add | — | O(log n) delete | — |
184
-
185
- \* Amortized (hash).
186
- \** At a known node.
187
-
188
- ---
189
-
190
- ## OrderedMultiMap and OrderedMultiSet — use cases
191
-
192
- **OrderedMultiSet** is a sorted collection that allows duplicate elements (like C++ `std::multiset`). Use it when you need ordering and multiple copies of the same value.
193
-
194
- | Use case | Example |
195
- |----------|---------|
196
- | **Sorted runs / leaderboard with ties** | Store scores; multiple users can have the same score. Iterate in sorted order, use `count(score)` for ties. |
197
- | **Event timeline with repeated timestamps** | Add events by time; several events can share the same time. `add(timestamp)`, iterate in order. |
198
- | **K-th smallest in a multiset** | Keep elements sorted; k-th element is at index `k - 1` in iteration. |
199
- | **Range counts** | Combined with binary search ideas: count elements in `[low, high]` using `count` and iteration. |
200
-
201
- **OrderedMultiMap** maps one key to multiple values while keeping keys sorted (like C++ `std::multimap`). Use it when a key can have several associated values and you need key order.
202
-
203
- | Use case | Example |
204
- |----------|---------|
205
- | **Inverted index** | Key = term, values = document IDs containing that term. `set(term, docId)` for each occurrence; `getAll(term)` returns all doc IDs. |
206
- | **Grouping by key** | Key = category, values = items. `set(category, item)`; iterate keys in order, use `getAll(key)` per group. |
207
- | **One-to-many relations** | Key = user ID, values = session IDs. `set(userId, sessionId)`; `getAll(userId)` lists all sessions. |
208
- | **Time-series by bucket** | Key = time bucket, values = events. Sorted keys give chronological buckets; `getAll(bucket)` gets events in that bucket. |
209
-
210
- ### OrderedMultiSet example
211
-
212
- ```ts
213
- import { OrderedMultiSet } from 'typescript-dsa-stl';
214
-
215
- const scores = new OrderedMultiSet<number>();
216
- scores.add(85); scores.add(92); scores.add(85); scores.add(78);
217
- console.log(scores.toArray()); // [78, 85, 85, 92]
218
- console.log(scores.count(85)); // 2
219
- scores.delete(85); // remove one 85
220
- console.log(scores.count(85)); // 1
221
- scores.deleteAll(85); // remove all 85s
222
- ```
223
-
224
- ### OrderedMultiMap example
225
-
226
- ```ts
227
- import { OrderedMultiMap } from 'typescript-dsa-stl';
228
-
229
- const index = new OrderedMultiMap<string, number>(); // term -> doc IDs
230
- index.set('typescript', 1); index.set('typescript', 3); index.set('stl', 2);
231
- console.log(index.getAll('typescript')); // [1, 3]
232
- console.log(index.get('stl')); // 2
233
- for (const [key, value] of index) {
234
- console.log(key, value); // keys in sorted order
235
- }
236
- ```
237
-
238
- ---
239
-
240
- ## For maintainers
241
-
242
- - **Build:** `npm run build` (also runs before `npm publish` via `prepublishOnly`)
243
- - **Publish:** `npm publish` (use `npm publish --access public` for a scoped package name)
244
-
245
- ---
246
-
247
- ## License
248
-
249
- MIT
1
+ # TypeScript_DSA
2
+
3
+ **This is the GitHub repository** for the npm package **[typescript-dsa-stl](https://www.npmjs.com/package/typescript-dsa-stl)**.
4
+
5
+ STL-style data structures and algorithms for TypeScript: **Vector**, **Stack**, **Queue**, **List**, **PriorityQueue**, **OrderedMap** (Map), **UnorderedMap**, **OrderedSet** (Set), **UnorderedSet**, **OrderedMultiMap**, **OrderedMultiSet**, and algorithms (`sort`, `binarySearch`, `lowerBound`, `min`, `max`, etc.). Install from npm to use in your project; this repo holds the source code.
6
+
7
+ ---
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ npm install typescript-dsa-stl
13
+ ```
14
+
15
+ ---
16
+
17
+ ## Quick start
18
+
19
+ ```ts
20
+ import {
21
+ Vector,
22
+ Stack,
23
+ Queue,
24
+ List,
25
+ PriorityQueue,
26
+ OrderedMap,
27
+ UnorderedMap,
28
+ OrderedSet,
29
+ UnorderedSet,
30
+ OrderedMultiMap,
31
+ OrderedMultiSet,
32
+ sort,
33
+ find,
34
+ binarySearch,
35
+ min,
36
+ max,
37
+ clamp,
38
+ range,
39
+ } from 'typescript-dsa-stl';
40
+
41
+ // Collections
42
+ const vec = new Vector<number>([1, 2, 3]);
43
+ vec.push(4);
44
+ console.log(vec.back()); // 4
45
+
46
+ const stack = new Stack<string>();
47
+ stack.push('a');
48
+ stack.push('b');
49
+ console.log(stack.top()); // 'b'
50
+
51
+ const queue = new Queue<number>();
52
+ queue.enqueue(1);
53
+ queue.enqueue(2);
54
+ console.log(queue.front()); // 1
55
+
56
+ const list = new List<number>();
57
+ list.pushBack(10);
58
+ const node = list.pushBack(20);
59
+ list.insertBefore(node, 15);
60
+ console.log(list.toArray()); // [10, 15, 20]
61
+
62
+ // PriorityQueue (max-heap by default)
63
+ const pq = new PriorityQueue<number>();
64
+ pq.push(3); pq.push(1); pq.push(4);
65
+ console.log(pq.top()); // 4
66
+ pq.pop();
67
+
68
+ // OrderedMap (keys sorted), UnorderedMap (hash)
69
+ const map = new UnorderedMap<string, number>();
70
+ map.set('a', 1); map.set('b', 2);
71
+ console.log(map.get('a')); // 1
72
+
73
+ // OrderedSet (sorted unique), UnorderedSet (hash)
74
+ const set = new UnorderedSet<number>([1, 2, 2, 3]);
75
+ console.log(set.size); // 3
76
+
77
+ // OrderedMultiSet (sorted, duplicates allowed)
78
+ const multiSet = new OrderedMultiSet<number>();
79
+ multiSet.add(3); multiSet.add(1); multiSet.add(2); multiSet.add(2);
80
+ console.log(multiSet.toArray()); // [1, 2, 2, 3]
81
+ console.log(multiSet.count(2)); // 2
82
+
83
+ // OrderedMultiMap (one key → multiple values, keys sorted)
84
+ const multiMap = new OrderedMultiMap<string, number>();
85
+ multiMap.set('scores', 90); multiMap.set('scores', 85); multiMap.set('scores', 95);
86
+ console.log(multiMap.getAll('scores')); // [90, 85, 95]
87
+
88
+ // Algorithms (work on arrays and iterables)
89
+ const arr = [3, 1, 4, 1, 5];
90
+ sort(arr); // [1, 1, 3, 4, 5]
91
+ find(arr, (n) => n > 3); // 4
92
+ min(arr); // 1
93
+ max(arr); // 5
94
+
95
+ const sorted = [1, 2, 4, 4, 5];
96
+ binarySearch(sorted, 4); // 2
97
+ lowerBound(sorted, 4); // 2
98
+ upperBound(sorted, 4); // 4
99
+
100
+ // Utils
101
+ clamp(42, 0, 10); // 10
102
+ range(0, 5); // [0, 1, 2, 3, 4]
103
+ ```
104
+
105
+ ### 2D and 3D vectors (like C++ `vector<vector<int>>`)
106
+
107
+ `Vector<T>` is generic, so you can nest it for 2D/3D grids:
108
+
109
+ | C++ | TypeScript |
110
+ |-----|------------|
111
+ | `vector<int>` | `Vector<number>` |
112
+ | `vector<vector<int>>` | `Vector<Vector<number>>` |
113
+ | `vector<vector<vector<int>>>` | `Vector<Vector<Vector<number>>>` |
114
+
115
+ **2D example:**
116
+
117
+ ```ts
118
+ import { Vector } from 'typescript-dsa-stl';
119
+
120
+ const grid = new Vector<Vector<number>>();
121
+
122
+ const row0 = new Vector<number>([1, 2, 3]);
123
+ const row1 = new Vector<number>([4, 5, 6]);
124
+ grid.push(row0);
125
+ grid.push(row1);
126
+
127
+ grid.at(0).at(1); // 2 (first row, second column)
128
+ grid.at(1).at(0); // 4 (second row, first column)
129
+
130
+ grid.at(0).set(1, 99);
131
+ grid.at(0).push(10);
132
+ ```
133
+
134
+ **3D example:**
135
+
136
+ ```ts
137
+ const cube = new Vector<Vector<Vector<number>>>();
138
+
139
+ const layer0 = new Vector<Vector<number>>();
140
+ layer0.push(new Vector<number>([1, 2]));
141
+ layer0.push(new Vector<number>([3, 4]));
142
+ cube.push(layer0);
143
+
144
+ cube.at(0).at(1).at(0); // 3 (layer 0, row 1, col 0)
145
+ ```
146
+
147
+ ### Graph adjacency list (like C++ `vector<vector<type>> graph(n)`)
148
+
149
+ You can model C++-style adjacency lists using the graph types and helpers exported from `typescript-dsa-stl/collections` (or the main package).
150
+
151
+ #### Unweighted adjacency list
152
+
153
+ C++:
154
+
155
+ ```cpp
156
+ int n = 5;
157
+ vector<vector<int>> graph(n);
158
+ graph[u].push_back(v); // or graph[u].pb(v);
159
+ ```
160
+
161
+ TypeScript (manual `push`):
162
+
163
+ ```ts
164
+ import type { AdjacencyList } from 'typescript-dsa-stl/collections';
165
+
166
+ const n = 5;
167
+ // number of vertices = n, initially all neighbors empty
168
+ const graph: AdjacencyList<number> = Array.from({ length: n }, () => []);
169
+
170
+ // C++: graph[u].push_back(v);
171
+ graph[u].push(v);
172
+
173
+ // Iteration is the same idea as in C++
174
+ for (const v of graph[u]) {
175
+ // neighbor v
176
+ }
177
+ ```
178
+
179
+ TypeScript (with helpers `addEdge` / `deleteEdge`):
180
+
181
+ ```ts
182
+ import type { AdjacencyList } from 'typescript-dsa-stl/collections';
183
+ import { addEdge, deleteEdge } from 'typescript-dsa-stl/collections';
184
+
185
+ const n = 5;
186
+ const graph: AdjacencyList<number> = Array.from({ length: n }, () => []);
187
+
188
+ addEdge(graph, u, v); // add u -> v
189
+ deleteEdge(graph, u, v); // remove all edges u -> v
190
+ ```
191
+
192
+ #### Weighted adjacency list
193
+
194
+ In C++ you might write:
195
+
196
+ ```cpp
197
+ int n = 5;
198
+ vector<vector<pair<int,int>>> graph(n);
199
+ graph[u].push_back({v, w}); // edge u -> v with weight w
200
+ ```
201
+
202
+ In TypeScript, use `WeightedEdge` and `WeightedAdjacencyList`:
203
+
204
+ ```ts
205
+ import type {
206
+ WeightedEdge,
207
+ WeightedAdjacencyList,
208
+ } from 'typescript-dsa-stl/collections';
209
+
210
+ const n = 5;
211
+ const graph: WeightedAdjacencyList<number, number> =
212
+ Array.from({ length: n }, () => []);
213
+
214
+ // C++: graph[u].push_back({v, w});
215
+ graph[u].push({ to: v, weight: w });
216
+
217
+ // When iterating, you get both neighbor and weight
218
+ for (const { to, weight } of graph[u]) {
219
+ // edge u -> to with cost = weight
220
+ }
221
+
222
+ // If you prefer a different vertex or weight type, just change the generics:
223
+ // const graph: WeightedAdjacencyList<string, bigint> = ...
224
+ ```
225
+
226
+ Or with the helper functions `addEdge` / `deleteEdge`:
227
+
228
+ ```ts
229
+ import type { WeightedAdjacencyList } from 'typescript-dsa-stl/collections';
230
+ import { addEdge, deleteEdge } from 'typescript-dsa-stl/collections';
231
+
232
+ const n = 5;
233
+ const graph: WeightedAdjacencyList<number, number> =
234
+ Array.from({ length: n }, () => []);
235
+
236
+ addEdge(graph, u, v, w); // add u -> v with weight w
237
+ deleteEdge(graph, u, v, w); // delete all edges u -> v with weight w
238
+ ```
239
+
240
+ #### Graph adjacency list — use cases
241
+
242
+ Use an **unweighted** graph (adjacency list) when you only care about connectivity; use a **weighted** graph when edges have costs (distance, time, capacity).
243
+
244
+ | Use case | When to use |
245
+ |----------|-------------|
246
+ | **BFS / DFS, connectivity** | Unweighted: shortest path in terms of hop count, connected components, cycle detection. |
247
+ | **Shortest path (Dijkstra), MST** | Weighted: edge weights as distances or costs; run Dijkstra, Prim, or Kruskal on the list. |
248
+ | **Social / dependency graphs** | Unweighted or weighted: followers, dependencies (e.g. build order), recommendation graphs. |
249
+ | **Grid / game graphs** | Unweighted: 4- or 8-neighbor grids; weighted if movement costs differ per cell. |
250
+ | **Network / flow** | Weighted: capacities or latencies on edges for max-flow or routing. |
251
+
252
+ ---
253
+
254
+ ## API overview
255
+
256
+ | Module | Exports |
257
+ |--------|--------|
258
+ | **Collections** | `Vector`, `Stack`, `Queue`, `List`, `ListNode`, `PriorityQueue`, `OrderedMap`, `UnorderedMap`, `OrderedSet`, `UnorderedSet`, `OrderedMultiMap`, `OrderedMultiSet`, `WeightedEdge`, `AdjacencyList`, `WeightedAdjacencyList`, `addEdge`, `deleteEdge` |
259
+ | **Algorithms** | `sort`, `find`, `findIndex`, `transform`, `filter`, `reduce`, `reverse`, `unique`, `binarySearch`, `lowerBound`, `upperBound`, `min`, `max`, `partition` |
260
+ | **Utils** | `clamp`, `range`, `noop`, `identity`, `swap` |
261
+ | **Types** | `Comparator`, `Predicate`, `UnaryFn`, `Reducer`, `IterableLike`, `toArray` |
262
+
263
+ ### Subpath imports (tree-shaking)
264
+
265
+ ```ts
266
+ import { Vector, Stack } from 'typescript-dsa-stl/collections';
267
+ import { sort, binarySearch } from 'typescript-dsa-stl/algorithms';
268
+ import { clamp, range } from 'typescript-dsa-stl/utils';
269
+ import type { Comparator } from 'typescript-dsa-stl/types';
270
+ ```
271
+
272
+ ---
273
+
274
+ ## Data structures
275
+
276
+ | Structure | Access | Insert end | Insert middle | Remove end | Remove middle |
277
+ |-----------|--------|------------|---------------|------------|---------------|
278
+ | **Vector** | O(1) | O(1)* | O(n) | O(1) | O(n) |
279
+ | **Stack** | — | O(1) | — | O(1) | — |
280
+ | **Queue** | — | O(1)* | — | O(1)* | — |
281
+ | **List** | O(n) | O(1) | O(1)** | O(1) | O(1)** |
282
+ | **PriorityQueue** | — | O(log n) | — | O(log n) | — |
283
+ | **OrderedMap** (Map) | O(log n) get | O(log n) set | — | O(log n) delete | — |
284
+ | **UnorderedMap** | O(1)* get/set | O(1)* | — | O(1)* delete | — |
285
+ | **OrderedSet** (Set) | O(log n) has | O(log n) add | — | O(log n) delete | — |
286
+ | **UnorderedSet** | O(1)* has/add | O(1)* | — | O(1)* delete | — |
287
+ | **OrderedMultiMap** | O(log n) get | O(log n) set | — | O(log n) delete | — |
288
+ | **OrderedMultiSet** | O(log n) has/count | O(log n) add | — | O(log n) delete | — |
289
+
290
+ \* Amortized (hash).
291
+ \** At a known node.
292
+
293
+ ---
294
+
295
+ ## OrderedMultiMap and OrderedMultiSet — use cases
296
+
297
+ **OrderedMultiSet** is a sorted collection that allows duplicate elements (like C++ `std::multiset`). Use it when you need ordering and multiple copies of the same value.
298
+
299
+ | Use case | Example |
300
+ |----------|---------|
301
+ | **Sorted runs / leaderboard with ties** | Store scores; multiple users can have the same score. Iterate in sorted order, use `count(score)` for ties. |
302
+ | **Event timeline with repeated timestamps** | Add events by time; several events can share the same time. `add(timestamp)`, iterate in order. |
303
+ | **K-th smallest in a multiset** | Keep elements sorted; k-th element is at index `k - 1` in iteration. |
304
+ | **Range counts** | Combined with binary search ideas: count elements in `[low, high]` using `count` and iteration. |
305
+
306
+ **OrderedMultiMap** maps one key to multiple values while keeping keys sorted (like C++ `std::multimap`). Use it when a key can have several associated values and you need key order.
307
+
308
+ | Use case | Example |
309
+ |----------|---------|
310
+ | **Inverted index** | Key = term, values = document IDs containing that term. `set(term, docId)` for each occurrence; `getAll(term)` returns all doc IDs. |
311
+ | **Grouping by key** | Key = category, values = items. `set(category, item)`; iterate keys in order, use `getAll(key)` per group. |
312
+ | **One-to-many relations** | Key = user ID, values = session IDs. `set(userId, sessionId)`; `getAll(userId)` lists all sessions. |
313
+ | **Time-series by bucket** | Key = time bucket, values = events. Sorted keys give chronological buckets; `getAll(bucket)` gets events in that bucket. |
314
+
315
+ ### OrderedMultiSet example
316
+
317
+ ```ts
318
+ import { OrderedMultiSet } from 'typescript-dsa-stl';
319
+
320
+ const scores = new OrderedMultiSet<number>();
321
+ scores.add(85); scores.add(92); scores.add(85); scores.add(78);
322
+ console.log(scores.toArray()); // [78, 85, 85, 92]
323
+ console.log(scores.count(85)); // 2
324
+ scores.delete(85); // remove one 85
325
+ console.log(scores.count(85)); // 1
326
+ scores.deleteAll(85); // remove all 85s
327
+ ```
328
+
329
+ ### OrderedMultiMap example
330
+
331
+ ```ts
332
+ import { OrderedMultiMap } from 'typescript-dsa-stl';
333
+
334
+ const index = new OrderedMultiMap<string, number>(); // term -> doc IDs
335
+ index.set('typescript', 1); index.set('typescript', 3); index.set('stl', 2);
336
+ console.log(index.getAll('typescript')); // [1, 3]
337
+ console.log(index.get('stl')); // 2
338
+ for (const [key, value] of index) {
339
+ console.log(key, value); // keys in sorted order
340
+ }
341
+ ```
342
+
343
+ ---
344
+
345
+ ## For maintainers
346
+
347
+ - **Build:** `npm run build` (also runs before `npm publish` via `prepublishOnly`)
348
+ - **Publish:** `npm publish` (use `npm publish --access public` for a scoped package name)
349
+
350
+ ---
351
+
352
+ ## License
353
+
354
+ MIT
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Graph adjacency list helpers (C++-style).
3
+ *
4
+ * These are designed so you can mirror common C++ patterns like:
5
+ * vector<vector<int>> adj(n);
6
+ * vector<vector<pair<int,int>>> adj(n);
7
+ */
8
+ /** Single weighted edge: `to` vertex with a `weight`. */
9
+ export interface WeightedEdge<Vertex = number, Weight = number> {
10
+ to: Vertex;
11
+ weight: Weight;
12
+ }
13
+ /**
14
+ * Unweighted adjacency list.
15
+ *
16
+ * C++: `vector<vector<int>> adj(n);`
17
+ * TS: `AdjacencyList<number>` (backed by `number[][]`).
18
+ */
19
+ export type AdjacencyList<Vertex = number> = Vertex[][];
20
+ /**
21
+ * Weighted adjacency list.
22
+ *
23
+ * C++: `vector<vector<pair<int,int>>> adj(n);`
24
+ * TS: `WeightedAdjacencyList<number, number>`
25
+ * (backed by `WeightedEdge<number, number>[][]`).
26
+ *
27
+ * Typical use:
28
+ * const adj: WeightedAdjacencyList<number, number> =
29
+ * Array.from({ length: n }, () => []);
30
+ * adj[u].push({ to: v, weight: w });
31
+ */
32
+ export type WeightedAdjacencyList<Vertex = number, Weight = number> = WeightedEdge<Vertex, Weight>[][];
33
+ /**
34
+ * Add an edge to a graph adjacency list.
35
+ *
36
+ * Overloads:
37
+ * - Unweighted: addEdge(adj, u, v)
38
+ * - Weighted: addEdge(adj, u, v, w)
39
+ */
40
+ export declare function addEdge(adj: AdjacencyList<number>, u: number, v: number): void;
41
+ export declare function addEdge(adj: WeightedAdjacencyList<number, number>, u: number, v: number, w: number): void;
42
+ /**
43
+ * Delete all edges u -> v from a graph adjacency list.
44
+ *
45
+ * Overloads:
46
+ * - Unweighted: deleteEdge(adj, u, v)
47
+ * - Weighted: deleteEdge(adj, u, v, w)
48
+ */
49
+ export declare function deleteEdge(adj: AdjacencyList<number>, u: number, v: number): void;
50
+ export declare function deleteEdge(adj: WeightedAdjacencyList<number, number>, u: number, v: number, w: number): void;
51
+ //# sourceMappingURL=Graph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Graph.d.ts","sourceRoot":"","sources":["../../src/collections/Graph.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,yDAAyD;AACzD,MAAM,WAAW,YAAY,CAAC,MAAM,GAAG,MAAM,EAAE,MAAM,GAAG,MAAM;IAC5D,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;GAKG;AACH,MAAM,MAAM,aAAa,CAAC,MAAM,GAAG,MAAM,IAAI,MAAM,EAAE,EAAE,CAAC;AAExD;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,qBAAqB,CAC/B,MAAM,GAAG,MAAM,EACf,MAAM,GAAG,MAAM,IACb,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC;AAErC;;;;;;GAMG;AACH,wBAAgB,OAAO,CACrB,GAAG,EAAE,aAAa,CAAC,MAAM,CAAC,EAC1B,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,GACR,IAAI,CAAC;AACR,wBAAgB,OAAO,CACrB,GAAG,EAAE,qBAAqB,CAAC,MAAM,EAAE,MAAM,CAAC,EAC1C,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,GACR,IAAI,CAAC;AAgBR;;;;;;GAMG;AACH,wBAAgB,UAAU,CACxB,GAAG,EAAE,aAAa,CAAC,MAAM,CAAC,EAC1B,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,GACR,IAAI,CAAC;AACR,wBAAgB,UAAU,CACxB,GAAG,EAAE,qBAAqB,CAAC,MAAM,EAAE,MAAM,CAAC,EAC1C,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,GACR,IAAI,CAAC"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Graph adjacency list helpers (C++-style).
3
+ *
4
+ * These are designed so you can mirror common C++ patterns like:
5
+ * vector<vector<int>> adj(n);
6
+ * vector<vector<pair<int,int>>> adj(n);
7
+ */
8
+ export function addEdge(adj, u, v, w) {
9
+ if (w === undefined) {
10
+ adj[u].push(v);
11
+ }
12
+ else {
13
+ adj[u].push({ to: v, weight: w });
14
+ }
15
+ }
16
+ export function deleteEdge(adj, u, v, w) {
17
+ const row = adj[u];
18
+ if (!row)
19
+ return;
20
+ if (w === undefined) {
21
+ // Unweighted: remove all neighbors equal to v.
22
+ for (let i = row.length - 1; i >= 0; i--) {
23
+ if (row[i] === v) {
24
+ row.splice(i, 1);
25
+ }
26
+ }
27
+ }
28
+ else {
29
+ // Weighted: remove all edges with { to: v, weight: w }.
30
+ for (let i = row.length - 1; i >= 0; i--) {
31
+ const edge = row[i];
32
+ if (edge.to === v && edge.weight === w) {
33
+ row.splice(i, 1);
34
+ }
35
+ }
36
+ }
37
+ }
38
+ //# sourceMappingURL=Graph.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Graph.js","sourceRoot":"","sources":["../../src/collections/Graph.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAmDH,MAAM,UAAU,OAAO,CACrB,GAEyC,EACzC,CAAS,EACT,CAAS,EACT,CAAU;IAEV,IAAI,CAAC,KAAK,SAAS,EAAE,CAAC;QACnB,GAA6B,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC5C,CAAC;SAAM,CAAC;QACL,GAA6C,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC;IAC/E,CAAC;AACH,CAAC;AAoBD,MAAM,UAAU,UAAU,CACxB,GAEyC,EACzC,CAAS,EACT,CAAS,EACT,CAAU;IAEV,MAAM,GAAG,GAAI,GAAqE,CAAC,CAAC,CAAC,CAAC;IAEtF,IAAI,CAAC,GAAG;QAAE,OAAO;IAEjB,IAAI,CAAC,KAAK,SAAS,EAAE,CAAC;QACpB,+CAA+C;QAC/C,KAAK,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YACzC,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC;gBACjB,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YACnB,CAAC;QACH,CAAC;IACH,CAAC;SAAM,CAAC;QACN,wDAAwD;QACxD,KAAK,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YACzC,MAAM,IAAI,GAAG,GAAG,CAAC,CAAC,CAAiC,CAAC;YACpD,IAAI,IAAI,CAAC,EAAE,KAAK,CAAC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACvC,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YACnB,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -10,4 +10,6 @@ export { UnorderedSet } from './UnorderedSet.js';
10
10
  export { OrderedMultiSet } from './OrderedMultiSet.js';
11
11
  export { OrderedMultiMap } from './OrderedMultiMap.js';
12
12
  export { RedBlackTree, RBNode } from './RedBlackTree.js';
13
+ export type { WeightedEdge, AdjacencyList, WeightedAdjacencyList } from './Graph.js';
14
+ export { addEdge, deleteEdge } from './Graph.js';
13
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/collections/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/collections/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AACzD,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACrF,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC"}
@@ -10,4 +10,5 @@ export { UnorderedSet } from './UnorderedSet.js';
10
10
  export { OrderedMultiSet } from './OrderedMultiSet.js';
11
11
  export { OrderedMultiMap } from './OrderedMultiMap.js';
12
12
  export { RedBlackTree, RBNode } from './RedBlackTree.js';
13
+ export { addEdge, deleteEdge } from './Graph.js';
13
14
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/collections/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/collections/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEzD,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC"}
package/dist/index.d.ts CHANGED
@@ -5,7 +5,8 @@
5
5
  * @example
6
6
  * import { Vector, Stack, Queue, List, sort, binarySearch, clamp } from 'typescript-dsa-stl';
7
7
  */
8
- export { Vector, Stack, Queue, List, ListNode, PriorityQueue, OrderedMap, UnorderedMap, OrderedSet, UnorderedSet, OrderedMultiSet, OrderedMultiMap, } from './collections/index.js';
8
+ export { Vector, Stack, Queue, List, ListNode, PriorityQueue, OrderedMap, UnorderedMap, OrderedSet, UnorderedSet, OrderedMultiSet, OrderedMultiMap, addEdge, deleteEdge, } from './collections/index.js';
9
+ export type { WeightedEdge, AdjacencyList, WeightedAdjacencyList } from './collections/index.js';
9
10
  export { sort, find, findIndex, transform, filter, reduce, reverse, unique, binarySearch, lowerBound, upperBound, min, max, partition, } from './algorithms/index.js';
10
11
  export { clamp, range, noop, identity, swap } from './utils/index.js';
11
12
  export type { Comparator, Predicate, UnaryFn, Reducer, IterableLike } from './types/index.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,MAAM,EACN,KAAK,EACL,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,aAAa,EACb,UAAU,EACV,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,eAAe,EACf,eAAe,GAChB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,IAAI,EACJ,IAAI,EACJ,SAAS,EACT,SAAS,EACT,MAAM,EACN,MAAM,EACN,OAAO,EACP,MAAM,EACN,YAAY,EACZ,UAAU,EACV,UAAU,EACV,GAAG,EACH,GAAG,EACH,SAAS,GACV,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACtE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC9F,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,MAAM,EACN,KAAK,EACL,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,aAAa,EACb,UAAU,EACV,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,eAAe,EACf,eAAe,EACf,OAAO,EACP,UAAU,GACX,MAAM,wBAAwB,CAAC;AAChC,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AACjG,OAAO,EACL,IAAI,EACJ,IAAI,EACJ,SAAS,EACT,SAAS,EACT,MAAM,EACN,MAAM,EACN,OAAO,EACP,MAAM,EACN,YAAY,EACZ,UAAU,EACV,UAAU,EACV,GAAG,EACH,GAAG,EACH,SAAS,GACV,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACtE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC9F,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC"}
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@
5
5
  * @example
6
6
  * import { Vector, Stack, Queue, List, sort, binarySearch, clamp } from 'typescript-dsa-stl';
7
7
  */
8
- export { Vector, Stack, Queue, List, ListNode, PriorityQueue, OrderedMap, UnorderedMap, OrderedSet, UnorderedSet, OrderedMultiSet, OrderedMultiMap, } from './collections/index.js';
8
+ export { Vector, Stack, Queue, List, ListNode, PriorityQueue, OrderedMap, UnorderedMap, OrderedSet, UnorderedSet, OrderedMultiSet, OrderedMultiMap, addEdge, deleteEdge, } from './collections/index.js';
9
9
  export { sort, find, findIndex, transform, filter, reduce, reverse, unique, binarySearch, lowerBound, upperBound, min, max, partition, } from './algorithms/index.js';
10
10
  export { clamp, range, noop, identity, swap } from './utils/index.js';
11
11
  export { toArray } from './types/index.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,MAAM,EACN,KAAK,EACL,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,aAAa,EACb,UAAU,EACV,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,eAAe,EACf,eAAe,GAChB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,IAAI,EACJ,IAAI,EACJ,SAAS,EACT,SAAS,EACT,MAAM,EACN,MAAM,EACN,OAAO,EACP,MAAM,EACN,YAAY,EACZ,UAAU,EACV,UAAU,EACV,GAAG,EACH,GAAG,EACH,SAAS,GACV,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAEtE,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,MAAM,EACN,KAAK,EACL,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,aAAa,EACb,UAAU,EACV,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,eAAe,EACf,eAAe,EACf,OAAO,EACP,UAAU,GACX,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,IAAI,EACJ,IAAI,EACJ,SAAS,EACT,SAAS,EACT,MAAM,EACN,MAAM,EACN,OAAO,EACP,MAAM,EACN,YAAY,EACZ,UAAU,EACV,UAAU,EACV,GAAG,EACH,GAAG,EACH,SAAS,GACV,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAEtE,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "typescript-dsa-stl",
3
- "version": "1.4.1",
3
+ "version": "2.0.1",
4
4
  "description": "STL-style data structures and algorithms for TypeScript: Vector, Stack, Queue, List, PriorityQueue, Map, Set, sort, binarySearch. Use like C++ STL.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",