data-structure-typed 2.2.6 → 2.2.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.
Files changed (72) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/CONTRIBUTING.md +47 -1
  3. package/README.md +19 -8
  4. package/README_CN.md +119 -275
  5. package/benchmark/report.html +1 -1
  6. package/benchmark/report.json +20 -324
  7. package/dist/cjs/index.cjs +109 -107
  8. package/dist/cjs/index.cjs.map +1 -1
  9. package/dist/cjs-legacy/index.cjs +109 -107
  10. package/dist/cjs-legacy/index.cjs.map +1 -1
  11. package/dist/esm/index.mjs +109 -107
  12. package/dist/esm/index.mjs.map +1 -1
  13. package/dist/esm-legacy/index.mjs +109 -107
  14. package/dist/esm-legacy/index.mjs.map +1 -1
  15. package/dist/leetcode/avl-tree-counter.mjs +2957 -0
  16. package/dist/leetcode/avl-tree-multi-map.mjs +2889 -0
  17. package/dist/leetcode/avl-tree.mjs +2720 -0
  18. package/dist/leetcode/binary-tree.mjs +1594 -0
  19. package/dist/leetcode/bst.mjs +2398 -0
  20. package/dist/leetcode/deque.mjs +683 -0
  21. package/dist/leetcode/directed-graph.mjs +1733 -0
  22. package/dist/leetcode/doubly-linked-list.mjs +709 -0
  23. package/dist/leetcode/hash-map.mjs +493 -0
  24. package/dist/leetcode/heap.mjs +542 -0
  25. package/dist/leetcode/max-heap.mjs +375 -0
  26. package/dist/leetcode/max-priority-queue.mjs +383 -0
  27. package/dist/leetcode/min-heap.mjs +363 -0
  28. package/dist/leetcode/min-priority-queue.mjs +371 -0
  29. package/dist/leetcode/priority-queue.mjs +363 -0
  30. package/dist/leetcode/queue.mjs +943 -0
  31. package/dist/leetcode/red-black-tree.mjs +2765 -0
  32. package/dist/leetcode/singly-linked-list.mjs +754 -0
  33. package/dist/leetcode/stack.mjs +217 -0
  34. package/dist/leetcode/tree-counter.mjs +3039 -0
  35. package/dist/leetcode/tree-multi-map.mjs +2913 -0
  36. package/dist/leetcode/trie.mjs +413 -0
  37. package/dist/leetcode/undirected-graph.mjs +1650 -0
  38. package/dist/types/data-structures/binary-tree/avl-tree-counter.d.ts +1 -1
  39. package/dist/types/data-structures/binary-tree/avl-tree-multi-map.d.ts +2 -2
  40. package/dist/types/data-structures/binary-tree/avl-tree.d.ts +10 -10
  41. package/dist/types/data-structures/binary-tree/binary-tree.d.ts +22 -23
  42. package/dist/types/data-structures/binary-tree/bst.d.ts +11 -11
  43. package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +1 -1
  44. package/dist/types/data-structures/binary-tree/tree-counter.d.ts +1 -1
  45. package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +2 -2
  46. package/dist/umd/data-structure-typed.js +105 -103
  47. package/dist/umd/data-structure-typed.js.map +1 -1
  48. package/dist/umd/data-structure-typed.min.js +2 -2
  49. package/dist/umd/data-structure-typed.min.js.map +1 -1
  50. package/package.json +48 -171
  51. package/src/data-structures/binary-tree/avl-tree-counter.ts +6 -6
  52. package/src/data-structures/binary-tree/avl-tree-multi-map.ts +13 -13
  53. package/src/data-structures/binary-tree/avl-tree.ts +15 -15
  54. package/src/data-structures/binary-tree/binary-tree.ts +53 -55
  55. package/src/data-structures/binary-tree/bst.ts +21 -22
  56. package/src/data-structures/binary-tree/red-black-tree.ts +3 -3
  57. package/src/data-structures/binary-tree/tree-counter.ts +4 -4
  58. package/src/data-structures/binary-tree/tree-multi-map.ts +13 -13
  59. package/test/performance/data-structures/binary-tree/red-black-tree.test.ts +1 -2
  60. package/test/unit/data-structures/binary-tree/avl-tree-counter.test.ts +30 -30
  61. package/test/unit/data-structures/binary-tree/avl-tree-multi-map.test.ts +46 -46
  62. package/test/unit/data-structures/binary-tree/avl-tree.test.ts +43 -43
  63. package/test/unit/data-structures/binary-tree/binary-tree.test.ts +151 -151
  64. package/test/unit/data-structures/binary-tree/bst.test.ts +99 -99
  65. package/test/unit/data-structures/binary-tree/overall.test.ts +20 -20
  66. package/test/unit/data-structures/binary-tree/red-black-tree.test.ts +141 -141
  67. package/test/unit/data-structures/binary-tree/tree-counter.test.ts +37 -37
  68. package/test/unit/data-structures/binary-tree/tree-multi-map.test.ts +145 -145
  69. package/tsup.config.js +50 -21
  70. package/tsup.leetcode.config.js +1 -1
  71. package/tsup.umd.config.js +29 -0
  72. package/tsup.node.config.js +0 -83
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
- ## [v2.2.6](https://github.com/zrwusa/data-structure-typed/compare/v2.2.3...main) (upcoming)
11
+ ## [v2.2.8](https://github.com/zrwusa/data-structure-typed/compare/v2.2.3...main) (upcoming)
12
12
 
13
13
  ## [v2.2.3](https://github.com/zrwusa/data-structure-typed/compare/v2.2.2...v2.2.3) (6 January 2026)
14
14
 
package/CONTRIBUTING.md CHANGED
@@ -83,9 +83,55 @@
83
83
  - click the `New pull request` on Github https://github.com/zrwusa/data-structure-typed/branches
84
84
 
85
85
  **performance inspection**
86
- - `node --inspect-brk benchmark/all.js`
86
+ - `node --inspect-brk perf/hello-world.js`
87
87
  - chrome://inspect/#devices -> Open dedicated DevTools for Node
88
88
 
89
+
90
+ **node:perf_hooks**
91
+ ```javascript
92
+ const { performance } = require('node:perf_hooks');
93
+
94
+ // Force garbage collection (run with --expose-gc flag)
95
+ const forceGC = () => {
96
+ if (global.gc) {
97
+ global.gc();
98
+ }
99
+ };
100
+
101
+ // Test Queue
102
+ function testQueue(QUANTITY) {
103
+ forceGC();
104
+ const initialMemory = process.memoryUsage().heapUsed;
105
+
106
+ const queue = new Queue();
107
+ const start = performance.now();
108
+
109
+ for (let i = 0; i < QUANTITY; i++) {
110
+ queue.push(i);
111
+ }
112
+
113
+ const end = performance.now();
114
+ const finalMemory = process.memoryUsage().heapUsed;
115
+ const memoryDelta = formatMemory(finalMemory - initialMemory);
116
+
117
+ console.log(`Queue push ${QUANTITY} elements: ${(end - start).toFixed(2)}ms`);
118
+ console.log(`Memory usage: ${memoryDelta}${CURRENT_UNIT} (growth)`);
119
+
120
+ return queue;
121
+ }
122
+
123
+ testDeque(1000000);
124
+
125
+ ```
126
+
127
+ ```shell
128
+ node --expose-gc benchmark/deque.js
129
+ ```
130
+
131
+ **performance info output**
132
+ -`node --prof perf/hello-world.js`
133
+ -`node --prof-process isolate-*.log > prof.txt`
134
+
89
135
  **Contributing New Data Structures**
90
136
 
91
137
  - Make your pull requests to be **specific** and **focused**. Instead of
package/README.md CHANGED
@@ -1,8 +1,19 @@
1
- # README: data-structure-typed Library
1
+ # data-structure-typed
2
+
3
+ English | [简体中文](./README_CN.md)
2
4
 
3
5
  A comprehensive TypeScript data structures library with production-ready implementations.
4
6
 
5
- **📚 [Quick Start](#-quick-start-30-seconds) • [Installation](#-installation) • [Full Docs](./docs/CONCEPTS.md) • [API Reference](./docs/REFERENCE.md) • [Playground](#-playground) • [Installation](#-installation) • [Examples](./docs/GUIDES.md)**
7
+ ![npm](https://img.shields.io/npm/dm/data-structure-typed)
8
+ ![GitHub contributors](https://img.shields.io/github/contributors/zrwusa/data-structure-typed)
9
+ ![npm package minimized gzipped size (select exports)](https://img.shields.io/bundlejs/size/data-structure-typed)
10
+ ![GitHub top language](https://img.shields.io/github/languages/top/zrwusa/data-structure-typed)
11
+ ![GITHUB Star](https://img.shields.io/github/stars/zrwusa/data-structure-typed)
12
+ ![eslint](https://aleen42.github.io/badges/src/eslint.svg)
13
+ ![NPM](https://img.shields.io/npm/l/data-structure-typed)
14
+ ![npm](https://img.shields.io/npm/v/data-structure-typed)
15
+
16
+ **📚 [Installation](#-installation) • [Quick Start](#-quick-start-30-seconds) • [Full Docs](#-documentation) • [API Reference](./docs/REFERENCE.md) • [Playground](#playground) • [Examples](./docs/GUIDES.md)**
6
17
 
7
18
  ---
8
19
 
@@ -484,14 +495,14 @@ const tree = new RedBlackTree([5, 2, 8]);
484
495
  console.log([...tree]); // [2, 5, 8] - Automatically sorted!
485
496
  ```
486
497
 
487
- ## 🏃🏻‍♀️ Playground
498
+ ## Playground
488
499
 
489
- Try it instantly:
500
+ 🏃🏻‍♀️ Try it instantly:
490
501
 
491
502
  - [Node.js TypeScript](https://stackblitz.com/edit/stackblitz-starters-e1vdy3zw?file=src%2Findex.ts)
492
- - [Node.js JavaScript](https://stackblitz.com/edit/stackblitz-starters-dgvchziu?file=src%2Findex.js)
493
- - [React TypeScript](https://stackblitz.com/edit/vitejs-vite-6xvhtdua?file=src%2FApp.tsx)
494
- - [NestJS](https://stackblitz.com/edit/nestjs-typescript-starter-3cyp7pel?file=src%2Franking%2Franking.service.ts)
503
+ - [Node.js JavaScript](https://stackblitz.com/edit/stackblitz-starters-oczhrfzn?file=src%2Findex.js)
504
+ - [React TypeScript](https://stackblitz.com/edit/vitejs-vite-7bva1zhd?file=src%2FApp.tsx)
505
+ - [NestJS](https://stackblitz.com/edit/nestjs-typescript-starter-q9n7okgc?file=src%2Fproduct%2Fservices%2Fproduct-price-index.service.ts)
495
506
 
496
507
 
497
508
  ### Step 4: Learn More
@@ -541,8 +552,8 @@ MIT
541
552
  ## 📚 Full Documentation Structure
542
553
 
543
554
  ```
555
+ README.md (this file)
544
556
  docs/
545
- ├── README.md (this file)
546
557
  ├── CONCEPTS.md (theory & fundamentals)
547
558
  ├── REFERENCE.md (API documentation)
548
559
  ├── ARCHITECTURE.md (design principles)