data-structure-typed 1.34.8 → 1.35.0

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 (142) hide show
  1. package/.eslintrc.js +1 -0
  2. package/.github/ISSUE_TEMPLATE/bug_report.md +38 -0
  3. package/.github/ISSUE_TEMPLATE/custom.md +10 -0
  4. package/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  5. package/CHANGELOG.md +1 -1
  6. package/CONTRIBUTING.md +0 -0
  7. package/README.md +8 -8
  8. package/dist/data-structures/binary-tree/aa-tree.js +2 -5
  9. package/dist/data-structures/binary-tree/aa-tree.js.map +1 -1
  10. package/dist/data-structures/binary-tree/abstract-binary-tree.js +280 -423
  11. package/dist/data-structures/binary-tree/abstract-binary-tree.js.map +1 -1
  12. package/dist/data-structures/binary-tree/avl-tree.js +63 -89
  13. package/dist/data-structures/binary-tree/avl-tree.js.map +1 -1
  14. package/dist/data-structures/binary-tree/b-tree.js +2 -5
  15. package/dist/data-structures/binary-tree/b-tree.js.map +1 -1
  16. package/dist/data-structures/binary-tree/binary-indexed-tree.js +17 -22
  17. package/dist/data-structures/binary-tree/binary-indexed-tree.js.map +1 -1
  18. package/dist/data-structures/binary-tree/binary-tree.js +11 -30
  19. package/dist/data-structures/binary-tree/binary-tree.js.map +1 -1
  20. package/dist/data-structures/binary-tree/bst.js +127 -214
  21. package/dist/data-structures/binary-tree/bst.js.map +1 -1
  22. package/dist/data-structures/binary-tree/rb-tree.js +19 -43
  23. package/dist/data-structures/binary-tree/rb-tree.js.map +1 -1
  24. package/dist/data-structures/binary-tree/segment-tree.js +80 -122
  25. package/dist/data-structures/binary-tree/segment-tree.js.map +1 -1
  26. package/dist/data-structures/binary-tree/splay-tree.js +2 -5
  27. package/dist/data-structures/binary-tree/splay-tree.js.map +1 -1
  28. package/dist/data-structures/binary-tree/tree-multiset.js +147 -218
  29. package/dist/data-structures/binary-tree/tree-multiset.js.map +1 -1
  30. package/dist/data-structures/binary-tree/two-three-tree.js +2 -5
  31. package/dist/data-structures/binary-tree/two-three-tree.js.map +1 -1
  32. package/dist/data-structures/graph/abstract-graph.js +338 -572
  33. package/dist/data-structures/graph/abstract-graph.js.map +1 -1
  34. package/dist/data-structures/graph/directed-graph.js +145 -275
  35. package/dist/data-structures/graph/directed-graph.js.map +1 -1
  36. package/dist/data-structures/graph/map-graph.js +46 -87
  37. package/dist/data-structures/graph/map-graph.js.map +1 -1
  38. package/dist/data-structures/graph/undirected-graph.js +90 -179
  39. package/dist/data-structures/graph/undirected-graph.js.map +1 -1
  40. package/dist/data-structures/hash/coordinate-map.js +23 -45
  41. package/dist/data-structures/hash/coordinate-map.js.map +1 -1
  42. package/dist/data-structures/hash/coordinate-set.js +20 -42
  43. package/dist/data-structures/hash/coordinate-set.js.map +1 -1
  44. package/dist/data-structures/hash/hash-map.js +85 -247
  45. package/dist/data-structures/hash/hash-map.js.map +1 -1
  46. package/dist/data-structures/hash/hash-table.js +87 -128
  47. package/dist/data-structures/hash/hash-table.js.map +1 -1
  48. package/dist/data-structures/hash/pair.js +2 -5
  49. package/dist/data-structures/hash/pair.js.map +1 -1
  50. package/dist/data-structures/hash/tree-map.js +2 -5
  51. package/dist/data-structures/hash/tree-map.js.map +1 -1
  52. package/dist/data-structures/hash/tree-set.js +2 -5
  53. package/dist/data-structures/hash/tree-set.js.map +1 -1
  54. package/dist/data-structures/heap/heap.js +56 -80
  55. package/dist/data-structures/heap/heap.js.map +1 -1
  56. package/dist/data-structures/heap/max-heap.js +8 -26
  57. package/dist/data-structures/heap/max-heap.js.map +1 -1
  58. package/dist/data-structures/heap/min-heap.js +8 -26
  59. package/dist/data-structures/heap/min-heap.js.map +1 -1
  60. package/dist/data-structures/linked-list/doubly-linked-list.js +149 -218
  61. package/dist/data-structures/linked-list/doubly-linked-list.js.map +1 -1
  62. package/dist/data-structures/linked-list/singly-linked-list.js +119 -218
  63. package/dist/data-structures/linked-list/singly-linked-list.js.map +1 -1
  64. package/dist/data-structures/linked-list/skip-linked-list.js +50 -70
  65. package/dist/data-structures/linked-list/skip-linked-list.js.map +1 -1
  66. package/dist/data-structures/matrix/matrix.js +7 -8
  67. package/dist/data-structures/matrix/matrix.js.map +1 -1
  68. package/dist/data-structures/matrix/matrix2d.js +57 -70
  69. package/dist/data-structures/matrix/matrix2d.js.map +1 -1
  70. package/dist/data-structures/matrix/navigator.js +18 -37
  71. package/dist/data-structures/matrix/navigator.js.map +1 -1
  72. package/dist/data-structures/matrix/vector2d.js +63 -84
  73. package/dist/data-structures/matrix/vector2d.js.map +1 -1
  74. package/dist/data-structures/priority-queue/max-priority-queue.js +13 -41
  75. package/dist/data-structures/priority-queue/max-priority-queue.js.map +1 -1
  76. package/dist/data-structures/priority-queue/min-priority-queue.js +13 -41
  77. package/dist/data-structures/priority-queue/min-priority-queue.js.map +1 -1
  78. package/dist/data-structures/priority-queue/priority-queue.js +93 -139
  79. package/dist/data-structures/priority-queue/priority-queue.js.map +1 -1
  80. package/dist/data-structures/queue/deque.js +82 -128
  81. package/dist/data-structures/queue/deque.js.map +1 -1
  82. package/dist/data-structures/queue/queue.js +57 -157
  83. package/dist/data-structures/queue/queue.js.map +1 -1
  84. package/dist/data-structures/stack/stack.js +21 -22
  85. package/dist/data-structures/stack/stack.js.map +1 -1
  86. package/dist/data-structures/tree/tree.js +32 -45
  87. package/dist/data-structures/tree/tree.js.map +1 -1
  88. package/dist/data-structures/trie/trie.js +93 -200
  89. package/dist/data-structures/trie/trie.js.map +1 -1
  90. package/dist/types/data-structures/abstract-binary-tree.js.map +1 -1
  91. package/dist/utils/utils.js +22 -107
  92. package/dist/utils/utils.js.map +1 -1
  93. package/lib/data-structures/binary-tree/abstract-binary-tree.d.ts +79 -78
  94. package/lib/data-structures/binary-tree/abstract-binary-tree.js +61 -141
  95. package/lib/data-structures/binary-tree/avl-tree.d.ts +9 -0
  96. package/lib/data-structures/binary-tree/avl-tree.js +22 -0
  97. package/lib/data-structures/binary-tree/bst.d.ts +3 -3
  98. package/lib/data-structures/binary-tree/bst.js +12 -15
  99. package/lib/data-structures/binary-tree/tree-multiset.d.ts +16 -18
  100. package/lib/data-structures/binary-tree/tree-multiset.js +26 -36
  101. package/lib/data-structures/graph/abstract-graph.d.ts +2 -2
  102. package/lib/data-structures/graph/abstract-graph.js +5 -5
  103. package/lib/data-structures/priority-queue/priority-queue.d.ts +3 -3
  104. package/lib/data-structures/priority-queue/priority-queue.js +3 -3
  105. package/lib/interfaces/abstract-binary-tree.d.ts +1 -83
  106. package/lib/interfaces/abstract-graph.d.ts +2 -14
  107. package/lib/interfaces/avl-tree.d.ts +3 -4
  108. package/lib/interfaces/binary-tree.d.ts +4 -2
  109. package/lib/interfaces/bst.d.ts +2 -12
  110. package/lib/interfaces/directed-graph.d.ts +0 -9
  111. package/lib/interfaces/rb-tree.d.ts +2 -3
  112. package/lib/interfaces/tree-multiset.d.ts +5 -4
  113. package/lib/interfaces/undirected-graph.d.ts +0 -2
  114. package/lib/types/data-structures/abstract-binary-tree.js +0 -1
  115. package/package.json +7 -7
  116. package/src/data-structures/binary-tree/abstract-binary-tree.ts +151 -203
  117. package/src/data-structures/binary-tree/avl-tree.ts +29 -0
  118. package/src/data-structures/binary-tree/bst.ts +12 -15
  119. package/src/data-structures/binary-tree/tree-multiset.ts +27 -39
  120. package/src/data-structures/graph/abstract-graph.ts +5 -5
  121. package/src/data-structures/priority-queue/priority-queue.ts +3 -3
  122. package/src/interfaces/abstract-binary-tree.ts +2 -183
  123. package/src/interfaces/abstract-graph.ts +2 -26
  124. package/src/interfaces/avl-tree.ts +4 -21
  125. package/src/interfaces/binary-tree.ts +3 -2
  126. package/src/interfaces/bst.ts +2 -27
  127. package/src/interfaces/directed-graph.ts +1 -18
  128. package/src/interfaces/rb-tree.ts +2 -5
  129. package/src/interfaces/tree-multiset.ts +4 -4
  130. package/src/interfaces/undirected-graph.ts +1 -4
  131. package/src/types/data-structures/abstract-binary-tree.ts +0 -1
  132. package/test/integration/avl-tree.test.ts +24 -24
  133. package/test/integration/bst.test.ts +71 -71
  134. package/test/unit/data-structures/binary-tree/avl-tree.test.ts +4 -4
  135. package/test/unit/data-structures/binary-tree/binary-tree.test.ts +1 -9
  136. package/test/unit/data-structures/binary-tree/bst.test.ts +8 -8
  137. package/test/unit/data-structures/binary-tree/overall.test.ts +1 -1
  138. package/test/unit/data-structures/binary-tree/tree-multiset.test.ts +9 -9
  139. package/test/unit/data-structures/linked-list/doubly-linked-list.test.ts +1 -1
  140. package/test/unit/data-structures/priority-queue/priority-queue.test.ts +4 -4
  141. package/umd/bundle.min.js +1 -1
  142. package/umd/bundle.min.js.map +1 -1
package/.eslintrc.js CHANGED
@@ -3,6 +3,7 @@ module.exports = {
3
3
  "plugin:@typescript-eslint/recommended",
4
4
  "prettier"
5
5
  ],
6
+ ignorePatterns: ["lib/", "dist/", "umd/", "coverage/", "docs/"],
6
7
  "rules": {
7
8
  "import/no-anonymous-default-export": "off",
8
9
  "@typescript-eslint/no-unused-vars": "error",
@@ -0,0 +1,38 @@
1
+ ---
2
+ name: Bug report
3
+ about: Create a report to help us improve
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Describe the bug**
11
+ A clear and concise description of what the bug is.
12
+
13
+ **To Reproduce**
14
+ Steps to reproduce the behavior:
15
+ 1. Go to '...'
16
+ 2. Click on '....'
17
+ 3. Scroll down to '....'
18
+ 4. See error
19
+
20
+ **Expected behavior**
21
+ A clear and concise description of what you expected to happen.
22
+
23
+ **Screenshots**
24
+ If applicable, add screenshots to help explain your problem.
25
+
26
+ **Desktop (please complete the following information):**
27
+ - OS: [e.g. iOS]
28
+ - Browser [e.g. chrome, safari]
29
+ - Version [e.g. 22]
30
+
31
+ **Smartphone (please complete the following information):**
32
+ - Device: [e.g. iPhone6]
33
+ - OS: [e.g. iOS8.1]
34
+ - Browser [e.g. stock browser, safari]
35
+ - Version [e.g. 22]
36
+
37
+ **Additional context**
38
+ Add any other context about the problem here.
@@ -0,0 +1,10 @@
1
+ ---
2
+ name: Custom issue template
3
+ about: Describe this issue template's purpose here.
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: Feature request
3
+ about: Suggest an idea for this project
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Is your feature request related to a problem? Please describe.**
11
+ A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12
+
13
+ **Describe the solution you'd like**
14
+ A clear and concise description of what you want to happen.
15
+
16
+ **Describe alternatives you've considered**
17
+ A clear and concise description of any alternative solutions or features you've considered.
18
+
19
+ **Additional context**
20
+ Add any other context or screenshots about the feature request here.
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.34.8](https://github.com/zrwusa/data-structure-typed/compare/v1.34.1...main) (upcoming)
11
+ ## [v1.34.9](https://github.com/zrwusa/data-structure-typed/compare/v1.34.1...main) (upcoming)
12
12
 
13
13
  ## [v1.34.1](https://github.com/zrwusa/data-structure-typed/compare/v1.33.4...v1.34.1) (6 October 2023)
14
14
 
File without changes
package/README.md CHANGED
@@ -1,11 +1,5 @@
1
1
  # Data Structure Typed
2
2
 
3
- Data Structures of Javascript & TypeScript.
4
-
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
-
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
-
9
3
  ![NPM](https://img.shields.io/npm/l/data-structure-typed)
10
4
  ![GitHub top language](https://img.shields.io/github/languages/top/zrwusa/data-structure-typed)
11
5
  ![npm](https://img.shields.io/npm/dw/data-structure-typed)
@@ -15,6 +9,12 @@ Now you can use this library in Node.js and browser environments in CommonJS(req
15
9
  ![npm](https://img.shields.io/npm/v/data-structure-typed)
16
10
 
17
11
 
12
+ Data Structures of Javascript & TypeScript.
13
+
14
+ 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]().
15
+
16
+ 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)
17
+
18
18
 
19
19
  [//]: # (![Branches](https://img.shields.io/badge/branches-55.47%25-red.svg?style=flat))
20
20
 
@@ -109,7 +109,7 @@ bst.getLeftMost()?.id === 1; // true
109
109
  bst.remove(6);
110
110
  bst.get(6); // null
111
111
  bst.isAVLBalanced(); // true
112
- bst.BFS()[0] === 11; // true
112
+ bst.bfs()[0] === 11; // true
113
113
 
114
114
  const objBST = new BST<BSTNode<{id: number, keyA: number}>>();
115
115
  objBST.add(11, {id: 11, keyA: 11});
@@ -145,7 +145,7 @@ expect(leftMost?.id).toBe(1);
145
145
  bst.remove(6);
146
146
  bst.get(6); // null
147
147
  bst.isAVLBalanced(); // true or false
148
- const bfsIDs = bst.BFS();
148
+ const bfsIDs = bst.bfs();
149
149
  bfsIDs[0] === 11; // true
150
150
  expect(bfsIDs[0]).toBe(11);
151
151
 
@@ -1,10 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AaTree = void 0;
4
- var AaTree = (function () {
5
- function AaTree() {
6
- }
7
- return AaTree;
8
- }());
4
+ class AaTree {
5
+ }
9
6
  exports.AaTree = AaTree;
10
7
  //# sourceMappingURL=aa-tree.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"aa-tree.js","sourceRoot":"","sources":["../../../src/data-structures/binary-tree/aa-tree.ts"],"names":[],"mappings":";;;AAAA;IAAA;IAAqB,CAAC;IAAD,aAAC;AAAD,CAAC,AAAtB,IAAsB;AAAT,wBAAM"}
1
+ {"version":3,"file":"aa-tree.js","sourceRoot":"","sources":["../../../src/data-structures/binary-tree/aa-tree.ts"],"names":[],"mappings":";;;AAAA,MAAa,MAAM;CAAG;AAAtB,wBAAsB"}