data-structure-typed 1.50.2 → 1.50.4

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 (203) hide show
  1. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -13
  2. package/CHANGELOG.md +1 -1
  3. package/README.md +23 -21
  4. package/README_zh-CN.md +7 -7
  5. package/SPECIFICATION.md +56 -0
  6. package/SPONSOR-zh-CN.md +90 -0
  7. package/SPONSOR.md +54 -0
  8. package/benchmark/report.html +13 -13
  9. package/benchmark/report.json +149 -155
  10. package/dist/cjs/data-structures/base/iterable-base.d.ts +6 -0
  11. package/dist/cjs/data-structures/base/iterable-base.js.map +1 -1
  12. package/dist/cjs/data-structures/binary-tree/{tree-multimap.d.ts → avl-tree-multi-map.d.ts} +43 -10
  13. package/dist/cjs/data-structures/binary-tree/{tree-multimap.js → avl-tree-multi-map.js} +50 -12
  14. package/dist/cjs/data-structures/binary-tree/avl-tree-multi-map.js.map +1 -0
  15. package/dist/cjs/data-structures/binary-tree/avl-tree.d.ts +29 -1
  16. package/dist/cjs/data-structures/binary-tree/avl-tree.js +33 -1
  17. package/dist/cjs/data-structures/binary-tree/avl-tree.js.map +1 -1
  18. package/dist/cjs/data-structures/binary-tree/binary-indexed-tree.d.ts +22 -0
  19. package/dist/cjs/data-structures/binary-tree/binary-indexed-tree.js +22 -0
  20. package/dist/cjs/data-structures/binary-tree/binary-indexed-tree.js.map +1 -1
  21. package/dist/cjs/data-structures/binary-tree/binary-tree.d.ts +1 -1
  22. package/dist/cjs/data-structures/binary-tree/binary-tree.js +1 -1
  23. package/dist/cjs/data-structures/binary-tree/bst.d.ts +46 -13
  24. package/dist/cjs/data-structures/binary-tree/bst.js +51 -20
  25. package/dist/cjs/data-structures/binary-tree/bst.js.map +1 -1
  26. package/dist/cjs/data-structures/binary-tree/index.d.ts +2 -1
  27. package/dist/cjs/data-structures/binary-tree/index.js +2 -1
  28. package/dist/cjs/data-structures/binary-tree/index.js.map +1 -1
  29. package/dist/cjs/data-structures/binary-tree/rb-tree.d.ts +54 -2
  30. package/dist/cjs/data-structures/binary-tree/rb-tree.js +90 -24
  31. package/dist/cjs/data-structures/binary-tree/rb-tree.js.map +1 -1
  32. package/dist/cjs/data-structures/binary-tree/segment-tree.d.ts +99 -6
  33. package/dist/cjs/data-structures/binary-tree/segment-tree.js +127 -10
  34. package/dist/cjs/data-structures/binary-tree/segment-tree.js.map +1 -1
  35. package/dist/cjs/data-structures/binary-tree/tree-multi-map.d.ts +200 -0
  36. package/dist/cjs/data-structures/binary-tree/tree-multi-map.js +400 -0
  37. package/dist/cjs/data-structures/binary-tree/tree-multi-map.js.map +1 -0
  38. package/dist/cjs/data-structures/graph/abstract-graph.d.ts +0 -78
  39. package/dist/cjs/data-structures/graph/abstract-graph.js +0 -189
  40. package/dist/cjs/data-structures/graph/abstract-graph.js.map +1 -1
  41. package/dist/cjs/data-structures/graph/directed-graph.d.ts +59 -0
  42. package/dist/cjs/data-structures/graph/directed-graph.js +105 -0
  43. package/dist/cjs/data-structures/graph/directed-graph.js.map +1 -1
  44. package/dist/cjs/data-structures/graph/undirected-graph.d.ts +60 -7
  45. package/dist/cjs/data-structures/graph/undirected-graph.js +126 -18
  46. package/dist/cjs/data-structures/graph/undirected-graph.js.map +1 -1
  47. package/dist/cjs/data-structures/hash/hash-map.d.ts +143 -23
  48. package/dist/cjs/data-structures/hash/hash-map.js +196 -62
  49. package/dist/cjs/data-structures/hash/hash-map.js.map +1 -1
  50. package/dist/cjs/data-structures/heap/heap.d.ts +29 -19
  51. package/dist/cjs/data-structures/heap/heap.js +29 -20
  52. package/dist/cjs/data-structures/heap/heap.js.map +1 -1
  53. package/dist/cjs/data-structures/linked-list/doubly-linked-list.d.ts +71 -25
  54. package/dist/cjs/data-structures/linked-list/doubly-linked-list.js +83 -25
  55. package/dist/cjs/data-structures/linked-list/doubly-linked-list.js.map +1 -1
  56. package/dist/cjs/data-structures/linked-list/singly-linked-list.d.ts +26 -3
  57. package/dist/cjs/data-structures/linked-list/singly-linked-list.js +34 -3
  58. package/dist/cjs/data-structures/linked-list/singly-linked-list.js.map +1 -1
  59. package/dist/cjs/data-structures/linked-list/skip-linked-list.d.ts +2 -2
  60. package/dist/cjs/data-structures/linked-list/skip-linked-list.js +2 -2
  61. package/dist/cjs/data-structures/matrix/matrix.d.ts +1 -1
  62. package/dist/cjs/data-structures/matrix/matrix.js +1 -1
  63. package/dist/cjs/data-structures/priority-queue/max-priority-queue.d.ts +10 -0
  64. package/dist/cjs/data-structures/priority-queue/max-priority-queue.js +10 -0
  65. package/dist/cjs/data-structures/priority-queue/max-priority-queue.js.map +1 -1
  66. package/dist/cjs/data-structures/priority-queue/min-priority-queue.d.ts +11 -0
  67. package/dist/cjs/data-structures/priority-queue/min-priority-queue.js +11 -0
  68. package/dist/cjs/data-structures/priority-queue/min-priority-queue.js.map +1 -1
  69. package/dist/cjs/data-structures/priority-queue/priority-queue.d.ts +8 -0
  70. package/dist/cjs/data-structures/priority-queue/priority-queue.js +8 -0
  71. package/dist/cjs/data-structures/priority-queue/priority-queue.js.map +1 -1
  72. package/dist/cjs/data-structures/queue/deque.d.ts +95 -21
  73. package/dist/cjs/data-structures/queue/deque.js +100 -16
  74. package/dist/cjs/data-structures/queue/deque.js.map +1 -1
  75. package/dist/cjs/data-structures/queue/queue.d.ts +65 -45
  76. package/dist/cjs/data-structures/queue/queue.js +65 -45
  77. package/dist/cjs/data-structures/queue/queue.js.map +1 -1
  78. package/dist/cjs/data-structures/stack/stack.d.ts +36 -22
  79. package/dist/cjs/data-structures/stack/stack.js +36 -22
  80. package/dist/cjs/data-structures/stack/stack.js.map +1 -1
  81. package/dist/cjs/data-structures/tree/tree.d.ts +57 -3
  82. package/dist/cjs/data-structures/tree/tree.js +77 -11
  83. package/dist/cjs/data-structures/tree/tree.js.map +1 -1
  84. package/dist/cjs/data-structures/trie/trie.d.ts +100 -36
  85. package/dist/cjs/data-structures/trie/trie.js +115 -36
  86. package/dist/cjs/data-structures/trie/trie.js.map +1 -1
  87. package/dist/cjs/types/data-structures/binary-tree/avl-tree-multi-map.d.ts +5 -0
  88. package/dist/cjs/types/data-structures/binary-tree/avl-tree-multi-map.js +3 -0
  89. package/dist/cjs/types/data-structures/binary-tree/avl-tree-multi-map.js.map +1 -0
  90. package/dist/cjs/types/data-structures/binary-tree/index.d.ts +2 -1
  91. package/dist/cjs/types/data-structures/binary-tree/index.js +2 -1
  92. package/dist/cjs/types/data-structures/binary-tree/index.js.map +1 -1
  93. package/dist/cjs/types/data-structures/binary-tree/tree-multi-map.d.ts +5 -0
  94. package/dist/cjs/types/data-structures/binary-tree/{tree-multimap.js → tree-multi-map.js} +1 -1
  95. package/dist/cjs/types/data-structures/binary-tree/tree-multi-map.js.map +1 -0
  96. package/dist/mjs/data-structures/base/iterable-base.d.ts +6 -0
  97. package/dist/mjs/data-structures/binary-tree/{tree-multimap.d.ts → avl-tree-multi-map.d.ts} +43 -10
  98. package/dist/mjs/data-structures/binary-tree/{tree-multimap.js → avl-tree-multi-map.js} +46 -9
  99. package/dist/mjs/data-structures/binary-tree/avl-tree.d.ts +29 -1
  100. package/dist/mjs/data-structures/binary-tree/avl-tree.js +34 -2
  101. package/dist/mjs/data-structures/binary-tree/binary-indexed-tree.d.ts +22 -0
  102. package/dist/mjs/data-structures/binary-tree/binary-indexed-tree.js +22 -0
  103. package/dist/mjs/data-structures/binary-tree/binary-tree.d.ts +1 -1
  104. package/dist/mjs/data-structures/binary-tree/binary-tree.js +1 -1
  105. package/dist/mjs/data-structures/binary-tree/bst.d.ts +46 -13
  106. package/dist/mjs/data-structures/binary-tree/bst.js +51 -20
  107. package/dist/mjs/data-structures/binary-tree/index.d.ts +2 -1
  108. package/dist/mjs/data-structures/binary-tree/index.js +2 -1
  109. package/dist/mjs/data-structures/binary-tree/rb-tree.d.ts +54 -2
  110. package/dist/mjs/data-structures/binary-tree/rb-tree.js +91 -25
  111. package/dist/mjs/data-structures/binary-tree/segment-tree.d.ts +99 -6
  112. package/dist/mjs/data-structures/binary-tree/segment-tree.js +127 -10
  113. package/dist/mjs/data-structures/binary-tree/tree-multi-map.d.ts +200 -0
  114. package/dist/mjs/data-structures/binary-tree/tree-multi-map.js +397 -0
  115. package/dist/mjs/data-structures/graph/abstract-graph.d.ts +0 -78
  116. package/dist/mjs/data-structures/graph/abstract-graph.js +0 -188
  117. package/dist/mjs/data-structures/graph/directed-graph.d.ts +59 -0
  118. package/dist/mjs/data-structures/graph/directed-graph.js +105 -0
  119. package/dist/mjs/data-structures/graph/undirected-graph.d.ts +60 -7
  120. package/dist/mjs/data-structures/graph/undirected-graph.js +127 -19
  121. package/dist/mjs/data-structures/hash/hash-map.d.ts +143 -23
  122. package/dist/mjs/data-structures/hash/hash-map.js +204 -70
  123. package/dist/mjs/data-structures/heap/heap.d.ts +29 -19
  124. package/dist/mjs/data-structures/heap/heap.js +29 -20
  125. package/dist/mjs/data-structures/linked-list/doubly-linked-list.d.ts +71 -25
  126. package/dist/mjs/data-structures/linked-list/doubly-linked-list.js +86 -28
  127. package/dist/mjs/data-structures/linked-list/singly-linked-list.d.ts +26 -3
  128. package/dist/mjs/data-structures/linked-list/singly-linked-list.js +36 -5
  129. package/dist/mjs/data-structures/linked-list/skip-linked-list.d.ts +2 -2
  130. package/dist/mjs/data-structures/linked-list/skip-linked-list.js +2 -2
  131. package/dist/mjs/data-structures/matrix/matrix.d.ts +1 -1
  132. package/dist/mjs/data-structures/matrix/matrix.js +1 -1
  133. package/dist/mjs/data-structures/priority-queue/max-priority-queue.d.ts +10 -0
  134. package/dist/mjs/data-structures/priority-queue/max-priority-queue.js +10 -0
  135. package/dist/mjs/data-structures/priority-queue/min-priority-queue.d.ts +11 -0
  136. package/dist/mjs/data-structures/priority-queue/min-priority-queue.js +11 -0
  137. package/dist/mjs/data-structures/priority-queue/priority-queue.d.ts +8 -0
  138. package/dist/mjs/data-structures/priority-queue/priority-queue.js +8 -0
  139. package/dist/mjs/data-structures/queue/deque.d.ts +95 -21
  140. package/dist/mjs/data-structures/queue/deque.js +105 -21
  141. package/dist/mjs/data-structures/queue/queue.d.ts +65 -45
  142. package/dist/mjs/data-structures/queue/queue.js +65 -45
  143. package/dist/mjs/data-structures/stack/stack.d.ts +36 -22
  144. package/dist/mjs/data-structures/stack/stack.js +36 -22
  145. package/dist/mjs/data-structures/tree/tree.d.ts +57 -3
  146. package/dist/mjs/data-structures/tree/tree.js +80 -14
  147. package/dist/mjs/data-structures/trie/trie.d.ts +100 -36
  148. package/dist/mjs/data-structures/trie/trie.js +118 -39
  149. package/dist/mjs/types/data-structures/binary-tree/avl-tree-multi-map.d.ts +5 -0
  150. package/dist/mjs/types/data-structures/binary-tree/index.d.ts +2 -1
  151. package/dist/mjs/types/data-structures/binary-tree/index.js +2 -1
  152. package/dist/mjs/types/data-structures/binary-tree/tree-multi-map.d.ts +5 -0
  153. package/dist/mjs/types/data-structures/binary-tree/tree-multi-map.js +1 -0
  154. package/dist/umd/data-structure-typed.js +1876 -656
  155. package/dist/umd/data-structure-typed.min.js +2 -2
  156. package/dist/umd/data-structure-typed.min.js.map +1 -1
  157. package/package.json +59 -58
  158. package/src/data-structures/base/iterable-base.ts +12 -0
  159. package/src/data-structures/binary-tree/{tree-multimap.ts → avl-tree-multi-map.ts} +59 -20
  160. package/src/data-structures/binary-tree/avl-tree.ts +37 -3
  161. package/src/data-structures/binary-tree/binary-indexed-tree.ts +22 -0
  162. package/src/data-structures/binary-tree/binary-tree.ts +1 -1
  163. package/src/data-structures/binary-tree/bst.ts +51 -19
  164. package/src/data-structures/binary-tree/index.ts +2 -1
  165. package/src/data-structures/binary-tree/rb-tree.ts +99 -28
  166. package/src/data-structures/binary-tree/segment-tree.ts +145 -11
  167. package/src/data-structures/binary-tree/tree-multi-map.ts +463 -0
  168. package/src/data-structures/graph/abstract-graph.ts +0 -211
  169. package/src/data-structures/graph/directed-graph.ts +122 -0
  170. package/src/data-structures/graph/undirected-graph.ts +143 -19
  171. package/src/data-structures/hash/hash-map.ts +228 -76
  172. package/src/data-structures/heap/heap.ts +31 -20
  173. package/src/data-structures/linked-list/doubly-linked-list.ts +96 -29
  174. package/src/data-structures/linked-list/singly-linked-list.ts +42 -6
  175. package/src/data-structures/linked-list/skip-linked-list.ts +2 -2
  176. package/src/data-structures/matrix/matrix.ts +1 -1
  177. package/src/data-structures/priority-queue/max-priority-queue.ts +10 -0
  178. package/src/data-structures/priority-queue/min-priority-queue.ts +11 -0
  179. package/src/data-structures/priority-queue/priority-queue.ts +8 -0
  180. package/src/data-structures/queue/deque.ts +118 -22
  181. package/src/data-structures/queue/queue.ts +68 -45
  182. package/src/data-structures/stack/stack.ts +39 -23
  183. package/src/data-structures/tree/tree.ts +89 -15
  184. package/src/data-structures/trie/trie.ts +131 -40
  185. package/src/types/data-structures/binary-tree/avl-tree-multi-map.ts +8 -0
  186. package/src/types/data-structures/binary-tree/index.ts +2 -1
  187. package/src/types/data-structures/binary-tree/tree-multi-map.ts +8 -0
  188. package/test/integration/index.html +2 -2
  189. package/test/performance/data-structures/graph/directed-graph.test.ts +1 -1
  190. package/test/unit/data-structures/binary-tree/{tree-multimap.test.ts → avl-tree-multi-map.test.ts} +55 -55
  191. package/test/unit/data-structures/binary-tree/overall.test.ts +24 -25
  192. package/test/unit/data-structures/binary-tree/tree-multi-map.test.ts +706 -0
  193. package/test/unit/data-structures/graph/abstract-graph.test.ts +3 -0
  194. package/test/unit/data-structures/graph/directed-graph.test.ts +189 -253
  195. package/test/unit/data-structures/graph/undirected-graph.test.ts +263 -18
  196. package/test/unit/data-structures/queue/queue.test.ts +2 -0
  197. package/test/unit/unrestricted-interconversion.test.ts +3 -3
  198. package/dist/cjs/data-structures/binary-tree/tree-multimap.js.map +0 -1
  199. package/dist/cjs/types/data-structures/binary-tree/tree-multimap.d.ts +0 -5
  200. package/dist/cjs/types/data-structures/binary-tree/tree-multimap.js.map +0 -1
  201. package/dist/mjs/types/data-structures/binary-tree/tree-multimap.d.ts +0 -5
  202. package/src/types/data-structures/binary-tree/tree-multimap.ts +0 -8
  203. /package/dist/mjs/types/data-structures/binary-tree/{tree-multimap.js → avl-tree-multi-map.js} +0 -0
@@ -8,9 +8,57 @@ const base_1 = require("../base");
8
8
  */
9
9
  class TrieNode {
10
10
  constructor(key) {
11
- this.key = key;
12
- this.isEnd = false;
13
- this.children = new Map();
11
+ this._key = key;
12
+ this._isEnd = false;
13
+ this._children = new Map();
14
+ }
15
+ /**
16
+ * The function returns the value of the protected variable _key.
17
+ * @returns The value of the `_key` property, which is a string.
18
+ */
19
+ get key() {
20
+ return this._key;
21
+ }
22
+ /**
23
+ * The above function sets the value of a protected variable called "key".
24
+ * @param {string} value - The value parameter is a string that represents the value to be assigned
25
+ * to the key.
26
+ */
27
+ set key(value) {
28
+ this._key = value;
29
+ }
30
+ /**
31
+ * The function returns the children of a TrieNode as a Map.
32
+ * @returns The `children` property of the TrieNode object, which is a Map containing string keys and
33
+ * TrieNode values.
34
+ */
35
+ get children() {
36
+ return this._children;
37
+ }
38
+ /**
39
+ * The function sets the value of the `_children` property of a TrieNode object.
40
+ * @param value - The value parameter is a Map object that represents the children of a TrieNode. The
41
+ * keys of the map are strings, which represent the characters that are associated with each child
42
+ * TrieNode. The values of the map are TrieNode objects, which represent the child nodes of the
43
+ * current TrieNode.
44
+ */
45
+ set children(value) {
46
+ this._children = value;
47
+ }
48
+ /**
49
+ * The function returns a boolean value indicating whether a certain condition is met.
50
+ * @returns The method is returning a boolean value, specifically the value of the variable `_isEnd`.
51
+ */
52
+ get isEnd() {
53
+ return this._isEnd;
54
+ }
55
+ /**
56
+ * The function sets the value of the "_isEnd" property.
57
+ * @param {boolean} value - The value parameter is a boolean value that indicates whether the current
58
+ * state is the end state or not.
59
+ */
60
+ set isEnd(value) {
61
+ this._isEnd = value;
14
62
  }
15
63
  }
16
64
  exports.TrieNode = TrieNode;
@@ -57,9 +105,8 @@ class Trie extends base_1.IterableElementBase {
57
105
  return this._size;
58
106
  }
59
107
  /**
60
- * The caseSensitive function is a getter that returns the value of the private _caseSensitive property.
61
- *
62
- * @return The value of the _casesensitive private variable
108
+ * The caseSensitive function is a getter that returns the value of the protected _caseSensitive property.
109
+ * @return The value of the _caseSensitive protected variable
63
110
  */
64
111
  get caseSensitive() {
65
112
  return this._caseSensitive;
@@ -72,12 +119,12 @@ class Trie extends base_1.IterableElementBase {
72
119
  return this._root;
73
120
  }
74
121
  /**
75
- * Time Complexity: O(M), where M is the length of the word being added.
76
- * Space Complexity: O(M) - Each character in the word adds a TrieNode.
122
+ * Time Complexity: O(l), where l is the length of the word being added.
123
+ * Space Complexity: O(l) - Each character in the word adds a TrieNode.
77
124
  */
78
125
  /**
79
- * Time Complexity: O(M), where M is the length of the word being added.
80
- * Space Complexity: O(M) - Each character in the word adds a TrieNode.
126
+ * Time Complexity: O(l), where l is the length of the word being added.
127
+ * Space Complexity: O(l) - Each character in the word adds a TrieNode.
81
128
  *
82
129
  * Add a word to the Trie structure.
83
130
  * @param {string} word - The word to add.
@@ -103,11 +150,11 @@ class Trie extends base_1.IterableElementBase {
103
150
  return isNewWord;
104
151
  }
105
152
  /**
106
- * Time Complexity: O(M), where M is the length of the input word.
153
+ * Time Complexity: O(l), where l is the length of the input word.
107
154
  * Space Complexity: O(1) - Constant space.
108
155
  */
109
156
  /**
110
- * Time Complexity: O(M), where M is the length of the input word.
157
+ * Time Complexity: O(l), where l is the length of the input word.
111
158
  * Space Complexity: O(1) - Constant space.
112
159
  *
113
160
  * Check if the Trie contains a given word.
@@ -126,6 +173,13 @@ class Trie extends base_1.IterableElementBase {
126
173
  return cur.isEnd;
127
174
  }
128
175
  /**
176
+ * Time Complexity: O(1)
177
+ * Space Complexity: O(1)
178
+ */
179
+ /**
180
+ * Time Complexity: O(1)
181
+ * Space Complexity: O(1)
182
+ *
129
183
  * The isEmpty function checks if the size of the queue is 0.
130
184
  * @return True if the size of the queue is 0
131
185
  */
@@ -133,12 +187,26 @@ class Trie extends base_1.IterableElementBase {
133
187
  return this.size === 0;
134
188
  }
135
189
  /**
136
- * Time Complexity: O(M), where M is the length of the word being deleted.
137
- * Space Complexity: O(M) - Due to the recursive DFS approach.
190
+ * Time Complexity: O(1)
191
+ * Space Complexity: O(1)
192
+ */
193
+ /**
194
+ * Time Complexity: O(1)
195
+ * Space Complexity: O(1)
196
+ *
197
+ * The clear function resets the size of the Trie to 0 and creates a new root TrieNode.
198
+ */
199
+ clear() {
200
+ this._size = 0;
201
+ this._root = new TrieNode('');
202
+ }
203
+ /**
204
+ * Time Complexity: O(l), where l is the length of the word being deleted.
205
+ * Space Complexity: O(n) - Due to the recursive DFS approach.
138
206
  */
139
207
  /**
140
- * Time Complexity: O(M), where M is the length of the word being deleted.
141
- * Space Complexity: O(M) - Due to the recursive DFS approach.
208
+ * Time Complexity: O(l), where l is the length of the word being deleted.
209
+ * Space Complexity: O(n) - Due to the recursive DFS approach.
142
210
  *
143
211
  * Remove a word from the Trie structure.
144
212
  * @param{string} word - The word to delete.
@@ -180,11 +248,11 @@ class Trie extends base_1.IterableElementBase {
180
248
  return isDeleted;
181
249
  }
182
250
  /**
183
- * Time Complexity: O(N), where N is the total number of nodes in the trie.
251
+ * Time Complexity: O(n), where n is the total number of nodes in the trie.
184
252
  * Space Complexity: O(1) - Constant space.
185
253
  */
186
254
  /**
187
- * Time Complexity: O(N), where N is the total number of nodes in the trie.
255
+ * Time Complexity: O(n), where n is the total number of nodes in the trie.
188
256
  * Space Complexity: O(1) - Constant space.
189
257
  *
190
258
  */
@@ -208,11 +276,11 @@ class Trie extends base_1.IterableElementBase {
208
276
  return maxDepth;
209
277
  }
210
278
  /**
211
- * Time Complexity: O(M), where M is the length of the input prefix.
279
+ * Time Complexity: O(l), where l is the length of the input prefix.
212
280
  * Space Complexity: O(1) - Constant space.
213
281
  */
214
282
  /**
215
- * Time Complexity: O(M), where M is the length of the input prefix.
283
+ * Time Complexity: O(l), where l is the length of the input prefix.
216
284
  * Space Complexity: O(1) - Constant space.
217
285
  *
218
286
  * Check if a given input string has an absolute prefix in the Trie, meaning it's not a complete word.
@@ -231,11 +299,11 @@ class Trie extends base_1.IterableElementBase {
231
299
  return !cur.isEnd;
232
300
  }
233
301
  /**
234
- * Time Complexity: O(M), where M is the length of the input prefix.
302
+ * Time Complexity: O(l), where l is the length of the input prefix.
235
303
  * Space Complexity: O(1) - Constant space.
236
304
  */
237
305
  /**
238
- * Time Complexity: O(M), where M is the length of the input prefix.
306
+ * Time Complexity: O(l), where l is the length of the input prefix.
239
307
  * Space Complexity: O(1) - Constant space.
240
308
  *
241
309
  * Check if a given input string is a prefix of any existing word in the Trie, whether as an absolute prefix or a complete word.
@@ -254,12 +322,12 @@ class Trie extends base_1.IterableElementBase {
254
322
  return true;
255
323
  }
256
324
  /**
257
- * Time Complexity: O(N), where N is the total number of nodes in the trie.
258
- * Space Complexity: O(M), where M is the length of the input prefix.
325
+ * Time Complexity: O(n), where n is the total number of nodes in the trie.
326
+ * Space Complexity: O(l), where l is the length of the input prefix.
259
327
  */
260
328
  /**
261
- * Time Complexity: O(N), where N is the total number of nodes in the trie.
262
- * Space Complexity: O(M), where M is the length of the input prefix.
329
+ * Time Complexity: O(n), where n is the total number of nodes in the trie.
330
+ * Space Complexity: O(l), where l is the length of the input prefix.
263
331
  *
264
332
  * Check if the input string is a common prefix in the Trie, meaning it's a prefix shared by all words in the Trie.
265
333
  * @param {string} input - The input string representing the common prefix to check for.
@@ -283,12 +351,12 @@ class Trie extends base_1.IterableElementBase {
283
351
  return commonPre === input;
284
352
  }
285
353
  /**
286
- * Time Complexity: O(N), where N is the total number of nodes in the trie.
287
- * Space Complexity: O(M), where M is the length of the longest common prefix.
354
+ * Time Complexity: O(n), where n is the total number of nodes in the trie.
355
+ * Space Complexity: O(l), where l is the length of the longest common prefix.
288
356
  */
289
357
  /**
290
- * Time Complexity: O(N), where N is the total number of nodes in the trie.
291
- * Space Complexity: O(M), where M is the length of the longest common prefix.
358
+ * Time Complexity: O(n), where n is the total number of nodes in the trie.
359
+ * Space Complexity: O(l), where l is the length of the longest common prefix.
292
360
  *
293
361
  * Get the longest common prefix among all the words stored in the Trie.
294
362
  * @returns {string} The longest common prefix found in the Trie.
@@ -308,12 +376,12 @@ class Trie extends base_1.IterableElementBase {
308
376
  return commonPre;
309
377
  }
310
378
  /**
311
- * Time Complexity: O(K * L), where K is the number of words retrieved, and L is the average length of the words.
312
- * Space Complexity: O(K * L) - The space required for the output array.
379
+ * Time Complexity: O(w * l), where w is the number of words retrieved, and l is the average length of the words.
380
+ * Space Complexity: O(w * l) - The space required for the output array.
313
381
  */
314
382
  /**
315
- * Time Complexity: O(K * L), where K is the number of words retrieved, and L is the average length of the words.
316
- * Space Complexity: O(K * L) - The space required for the output array.
383
+ * Time Complexity: O(w * l), where w is the number of words retrieved, and l is the average length of the words.
384
+ * Space Complexity: O(w * l) - The space required for the output array.
317
385
  *
318
386
  * The `getAll` function returns an array of all words in a Trie data structure that start with a given prefix.
319
387
  * @param {string} prefix - The `prefix` parameter is a string that represents the prefix that we want to search for in the
@@ -422,6 +490,17 @@ class Trie extends base_1.IterableElementBase {
422
490
  }
423
491
  return newTrie;
424
492
  }
493
+ /**
494
+ * Time Complexity: O(n)
495
+ * Space Complexity: O(n)
496
+ */
497
+ /**
498
+ * Time Complexity: O(n)
499
+ * Space Complexity: O(n)
500
+ *
501
+ * The function `_getIterator` returns an iterable iterator that performs a depth-first search on a
502
+ * trie data structure and yields all the paths to the end nodes.
503
+ */
425
504
  *_getIterator() {
426
505
  function* _dfs(node, path) {
427
506
  if (node.isEnd) {
@@ -434,11 +513,11 @@ class Trie extends base_1.IterableElementBase {
434
513
  yield* _dfs(this.root, '');
435
514
  }
436
515
  /**
437
- * Time Complexity: O(M), where M is the length of the input string.
516
+ * Time Complexity: O(l), where l is the length of the input string.
438
517
  * Space Complexity: O(1) - Constant space.
439
518
  */
440
519
  /**
441
- * Time Complexity: O(M), where M is the length of the input string.
520
+ * Time Complexity: O(l), where l is the length of the input string.
442
521
  * Space Complexity: O(1) - Constant space.
443
522
  *
444
523
  * @param str
@@ -1 +1 @@
1
- {"version":3,"file":"trie.js","sourceRoot":"","sources":["../../../../src/data-structures/trie/trie.ts"],"names":[],"mappings":";;;AAQA,kCAA8C;AAE9C;;;GAGG;AACH,MAAa,QAAQ;IAKnB,YAAY,GAAW;QACrB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,QAAQ,GAAG,IAAI,GAAG,EAAoB,CAAC;IAC9C,CAAC;CACF;AAVD,4BAUC;AAED;;;;;;;;;;;;GAYG;AACH,MAAa,IAAK,SAAQ,0BAAiC;IACzD;;;;;OAKG;IACH,YAAY,QAA0B,EAAE,EAAE,OAAqB;QAC7D,KAAK,EAAE,CAAC;QAUA,UAAK,GAAW,CAAC,CAAC;QAUlB,mBAAc,GAAY,IAAI,CAAC;QAW/B,UAAK,GAAa,IAAI,QAAQ,CAAC,EAAE,CAAC,CAAC;QA9B3C,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC;YAClC,IAAI,aAAa,KAAK,SAAS;gBAAE,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;QACvE,CAAC;QACD,IAAI,KAAK,EAAE,CAAC;YACV,KAAK,MAAM,IAAI,IAAI,KAAK;gBAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC3C,CAAC;IACH,CAAC;IAID;;;OAGG;IACH,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAID;;;;OAIG;IACH,IAAI,aAAa;QACf,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IAID;;;OAGG;IACH,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED;;;OAGG;IAEH;;;;;;;OAOG;IACH,GAAG,CAAC,IAAY;QACd,IAAI,GAAG,IAAI,CAAC,YAAY,CAAC,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B,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE,CAAC;YACxB,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;YACvD,KAAK,EAAE,CAAC;QACV,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;;OAGG;IAEH;;;;;;OAMG;IACM,CAAE,YAAY;QACrB,QAAQ,CAAC,CAAC,IAAI,CAAC,IAAc,EAAE,IAAY;YACzC,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;gBACf,MAAM,IAAI,CAAC;YACb,CAAC;YACD,KAAK,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;gBAC9C,KAAK,CAAC,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,GAAG,IAAI,CAAC,CAAC;YACtC,CAAC;QACH,CAAC;QAED,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IAC7B,CAAC;IAED;;;OAGG;IAEH;;;;;;OAMG;IACO,YAAY,CAAC,GAAW;QAChC,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC;YACzB,GAAG,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC,+CAA+C;QAC1E,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;CACF;AAneD,oBAmeC"}
@@ -0,0 +1,5 @@
1
+ import { AVLTreeMultiMap, AVLTreeMultiMapNode } from '../../../data-structures';
2
+ import type { AVLTreeOptions } from './avl-tree';
3
+ export type AVLTreeMultiMapNodeNested<K, V> = AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNode<K, V, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
4
+ export type AVLTreeMultiMapNested<K, V, N extends AVLTreeMultiMapNode<K, V, N>> = AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, AVLTreeMultiMap<K, V, N, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
5
+ export type AVLTreeMultiMapOptions<K> = AVLTreeOptions<K> & {};
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=avl-tree-multi-map.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"avl-tree-multi-map.js","sourceRoot":"","sources":["../../../../../src/types/data-structures/binary-tree/avl-tree-multi-map.ts"],"names":[],"mappings":""}
@@ -2,5 +2,6 @@ export * from './binary-tree';
2
2
  export * from './bst';
3
3
  export * from './avl-tree';
4
4
  export * from './segment-tree';
5
- export * from './tree-multimap';
5
+ export * from './avl-tree-multi-map';
6
6
  export * from './rb-tree';
7
+ export * from './tree-multi-map';
@@ -18,6 +18,7 @@ __exportStar(require("./binary-tree"), exports);
18
18
  __exportStar(require("./bst"), exports);
19
19
  __exportStar(require("./avl-tree"), exports);
20
20
  __exportStar(require("./segment-tree"), exports);
21
- __exportStar(require("./tree-multimap"), exports);
21
+ __exportStar(require("./avl-tree-multi-map"), exports);
22
22
  __exportStar(require("./rb-tree"), exports);
23
+ __exportStar(require("./tree-multi-map"), exports);
23
24
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/types/data-structures/binary-tree/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,wCAAsB;AACtB,6CAA2B;AAC3B,iDAA+B;AAC/B,kDAAgC;AAChC,4CAA0B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/types/data-structures/binary-tree/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,wCAAsB;AACtB,6CAA2B;AAC3B,iDAA+B;AAC/B,uDAAqC;AACrC,4CAA0B;AAC1B,mDAAiC"}
@@ -0,0 +1,5 @@
1
+ import { TreeMultiMap, TreeMultiMapNode } from '../../../data-structures';
2
+ import type { RBTreeOptions } from './rb-tree';
3
+ export type TreeMultiMapNodeNested<K, V> = TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
4
+ export type TreeMultiMapNested<K, V, N extends TreeMultiMapNode<K, V, N>> = TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, TreeMultiMap<K, V, N, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
5
+ export type TreeMultiMapOptions<K> = RBTreeOptions<K> & {};
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=tree-multimap.js.map
3
+ //# sourceMappingURL=tree-multi-map.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tree-multi-map.js","sourceRoot":"","sources":["../../../../../src/types/data-structures/binary-tree/tree-multi-map.ts"],"names":[],"mappings":""}
@@ -198,7 +198,10 @@ export declare abstract class IterableEntryBase<K = any, V = any> {
198
198
  */
199
199
  print(): void;
200
200
  abstract isEmpty(): boolean;
201
+ abstract clear(): void;
201
202
  abstract clone(): any;
203
+ abstract map(...args: any[]): any;
204
+ abstract filter(...args: any[]): any;
202
205
  protected abstract _getIterator(...args: any[]): IterableIterator<[K, V]>;
203
206
  }
204
207
  export declare abstract class IterableElementBase<E = any, C = any> {
@@ -343,6 +346,9 @@ export declare abstract class IterableElementBase<E = any, C = any> {
343
346
  */
344
347
  print(): void;
345
348
  abstract isEmpty(): boolean;
349
+ abstract clear(): void;
346
350
  abstract clone(): C;
351
+ abstract map(...args: any[]): any;
352
+ abstract filter(...args: any[]): any;
347
353
  protected abstract _getIterator(...args: any[]): IterableIterator<E>;
348
354
  }
@@ -5,12 +5,11 @@
5
5
  * @copyright Copyright (c) 2022 Tyler Zeng <zrwusa@gmail.com>
6
6
  * @license MIT License
7
7
  */
8
- import type { BinaryTreeDeleteResult, BSTNKeyOrNode, BTNCallback, KeyOrNodeOrEntry, TreeMultimapNested, TreeMultimapNodeNested, TreeMultimapOptions } from '../../types';
8
+ import type { AVLTreeMultiMapNested, AVLTreeMultiMapNodeNested, AVLTreeMultiMapOptions, BinaryTreeDeleteResult, BSTNKeyOrNode, BTNCallback, KeyOrNodeOrEntry } from '../../types';
9
9
  import { IterationType } from '../../types';
10
10
  import { IBinaryTree } from '../../interfaces';
11
11
  import { AVLTree, AVLTreeNode } from './avl-tree';
12
- export declare class TreeMultimapNode<K = any, V = any, NODE extends TreeMultimapNode<K, V, NODE> = TreeMultimapNodeNested<K, V>> extends AVLTreeNode<K, V, NODE> {
13
- count: number;
12
+ export declare class AVLTreeMultiMapNode<K = any, V = any, NODE extends AVLTreeMultiMapNode<K, V, NODE> = AVLTreeMultiMapNodeNested<K, V>> extends AVLTreeNode<K, V, NODE> {
14
13
  /**
15
14
  * The constructor function initializes a BinaryTreeNode object with a key, value, and count.
16
15
  * @param {K} key - The `key` parameter is of type `K` and represents the unique identifier
@@ -22,13 +21,30 @@ export declare class TreeMultimapNode<K = any, V = any, NODE extends TreeMultima
22
21
  * parameter when creating a new instance of the `BinaryTreeNode` class.
23
22
  */
24
23
  constructor(key: K, value?: V, count?: number);
24
+ protected _count: number;
25
+ /**
26
+ * The function returns the value of the protected variable _count.
27
+ * @returns The count property of the object, which is of type number.
28
+ */
29
+ get count(): number;
30
+ /**
31
+ * The above function sets the value of the count property.
32
+ * @param {number} value - The value parameter is of type number, which means it can accept any
33
+ * numeric value.
34
+ */
35
+ set count(value: number);
25
36
  }
26
37
  /**
27
- * The only distinction between a TreeMultimap and a AVLTree lies in the ability of the former to store duplicate nodes through the utilization of counters.
38
+ * The only distinction between a AVLTreeMultiMap and a AVLTree lies in the ability of the former to store duplicate nodes through the utilization of counters.
28
39
  */
29
- export declare class TreeMultimap<K = any, V = any, NODE extends TreeMultimapNode<K, V, NODE> = TreeMultimapNode<K, V, TreeMultimapNodeNested<K, V>>, TREE extends TreeMultimap<K, V, NODE, TREE> = TreeMultimap<K, V, NODE, TreeMultimapNested<K, V, NODE>>> extends AVLTree<K, V, NODE, TREE> implements IBinaryTree<K, V, NODE, TREE> {
30
- constructor(keysOrNodesOrEntries?: Iterable<KeyOrNodeOrEntry<K, V, NODE>>, options?: TreeMultimapOptions<K>);
31
- private _count;
40
+ export declare class AVLTreeMultiMap<K = any, V = any, NODE extends AVLTreeMultiMapNode<K, V, NODE> = AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNodeNested<K, V>>, TREE extends AVLTreeMultiMap<K, V, NODE, TREE> = AVLTreeMultiMap<K, V, NODE, AVLTreeMultiMapNested<K, V, NODE>>> extends AVLTree<K, V, NODE, TREE> implements IBinaryTree<K, V, NODE, TREE> {
41
+ constructor(keysOrNodesOrEntries?: Iterable<KeyOrNodeOrEntry<K, V, NODE>>, options?: AVLTreeMultiMapOptions<K>);
42
+ protected _count: number;
43
+ /**
44
+ * The function calculates the sum of the count property of all nodes in a tree using depth-first
45
+ * search.
46
+ * @returns the sum of the count property of all nodes in the tree.
47
+ */
32
48
  get count(): number;
33
49
  /**
34
50
  * The function creates a new BSTNode with the given key, value, and count.
@@ -40,7 +56,16 @@ export declare class TreeMultimap<K = any, V = any, NODE extends TreeMultimapNod
40
56
  * @returns A new instance of the BSTNode class with the specified key, value, and count (if provided).
41
57
  */
42
58
  createNode(key: K, value?: V, count?: number): NODE;
43
- createTree(options?: TreeMultimapOptions<K>): TREE;
59
+ /**
60
+ * The function creates a new AVLTreeMultiMap object with the specified options and returns it.
61
+ * @param [options] - The `options` parameter is an optional object that contains additional
62
+ * configuration options for creating the `AVLTreeMultiMap` object. It can include properties such as
63
+ * `iterationType` and `variant`, which are used to specify the type of iteration and the variant of
64
+ * the tree, respectively. These properties can be
65
+ * @returns a new instance of the `AVLTreeMultiMap` class, with the provided options merged with the
66
+ * default options. The returned value is casted as `TREE`.
67
+ */
68
+ createTree(options?: AVLTreeMultiMapOptions<K>): TREE;
44
69
  /**
45
70
  * The function `keyValueOrEntryToNode` converts an keyOrNodeOrEntry object into a node object.
46
71
  * @param keyOrNodeOrEntry - The `keyOrNodeOrEntry` parameter is of type `KeyOrNodeOrEntry<K, V, NODE>`, which means it
@@ -54,9 +79,9 @@ export declare class TreeMultimap<K = any, V = any, NODE extends TreeMultimapNod
54
79
  */
55
80
  keyValueOrEntryToNode(keyOrNodeOrEntry: KeyOrNodeOrEntry<K, V, NODE>, value?: V, count?: number): NODE | undefined;
56
81
  /**
57
- * The function checks if an keyOrNodeOrEntry is an instance of the TreeMultimapNode class.
82
+ * The function checks if an keyOrNodeOrEntry is an instance of the AVLTreeMultiMapNode class.
58
83
  * @param keyOrNodeOrEntry - The `keyOrNodeOrEntry` parameter is of type `KeyOrNodeOrEntry<K, V, NODE>`.
59
- * @returns a boolean value indicating whether the keyOrNodeOrEntry is an instance of the TreeMultimapNode
84
+ * @returns a boolean value indicating whether the keyOrNodeOrEntry is an instance of the AVLTreeMultiMapNode
60
85
  * class.
61
86
  */
62
87
  isNode(keyOrNodeOrEntry: KeyOrNodeOrEntry<K, V, NODE>): keyOrNodeOrEntry is NODE;
@@ -154,5 +179,13 @@ export declare class TreeMultimap<K = any, V = any, NODE extends TreeMultimapNod
154
179
  * if either `srcNode` or `destNode` is undefined.
155
180
  */
156
181
  protected _swapProperties(srcNode: BSTNKeyOrNode<K, NODE>, destNode: BSTNKeyOrNode<K, NODE>): NODE | undefined;
182
+ /**
183
+ * The function replaces an old node with a new node and updates the count property of the new node.
184
+ * @param {NODE} oldNode - The `oldNode` parameter is of type `NODE` and represents the node that
185
+ * needs to be replaced in a data structure.
186
+ * @param {NODE} newNode - The `newNode` parameter is an object of type `NODE`.
187
+ * @returns The method is returning the result of calling the `_replaceNode` method from the
188
+ * superclass, after updating the `count` property of the `newNode` object.
189
+ */
157
190
  protected _replaceNode(oldNode: NODE, newNode: NODE): NODE;
158
191
  }
@@ -1,7 +1,6 @@
1
1
  import { FamilyPosition, IterationType } from '../../types';
2
2
  import { AVLTree, AVLTreeNode } from './avl-tree';
3
- export class TreeMultimapNode extends AVLTreeNode {
4
- count;
3
+ export class AVLTreeMultiMapNode extends AVLTreeNode {
5
4
  /**
6
5
  * The constructor function initializes a BinaryTreeNode object with a key, value, and count.
7
6
  * @param {K} key - The `key` parameter is of type `K` and represents the unique identifier
@@ -16,11 +15,27 @@ export class TreeMultimapNode extends AVLTreeNode {
16
15
  super(key, value);
17
16
  this.count = count;
18
17
  }
18
+ _count = 1;
19
+ /**
20
+ * The function returns the value of the protected variable _count.
21
+ * @returns The count property of the object, which is of type number.
22
+ */
23
+ get count() {
24
+ return this._count;
25
+ }
26
+ /**
27
+ * The above function sets the value of the count property.
28
+ * @param {number} value - The value parameter is of type number, which means it can accept any
29
+ * numeric value.
30
+ */
31
+ set count(value) {
32
+ this._count = value;
33
+ }
19
34
  }
20
35
  /**
21
- * The only distinction between a TreeMultimap and a AVLTree lies in the ability of the former to store duplicate nodes through the utilization of counters.
36
+ * The only distinction between a AVLTreeMultiMap and a AVLTree lies in the ability of the former to store duplicate nodes through the utilization of counters.
22
37
  */
23
- export class TreeMultimap extends AVLTree {
38
+ export class AVLTreeMultiMap extends AVLTree {
24
39
  constructor(keysOrNodesOrEntries = [], options) {
25
40
  super([], options);
26
41
  if (keysOrNodesOrEntries)
@@ -28,6 +43,11 @@ export class TreeMultimap extends AVLTree {
28
43
  }
29
44
  _count = 0;
30
45
  // TODO the _count is not accurate after nodes count modified
46
+ /**
47
+ * The function calculates the sum of the count property of all nodes in a tree using depth-first
48
+ * search.
49
+ * @returns the sum of the count property of all nodes in the tree.
50
+ */
31
51
  get count() {
32
52
  let sum = 0;
33
53
  this.dfs(node => (sum += node.count));
@@ -43,10 +63,19 @@ export class TreeMultimap extends AVLTree {
43
63
  * @returns A new instance of the BSTNode class with the specified key, value, and count (if provided).
44
64
  */
45
65
  createNode(key, value, count) {
46
- return new TreeMultimapNode(key, value, count);
66
+ return new AVLTreeMultiMapNode(key, value, count);
47
67
  }
68
+ /**
69
+ * The function creates a new AVLTreeMultiMap object with the specified options and returns it.
70
+ * @param [options] - The `options` parameter is an optional object that contains additional
71
+ * configuration options for creating the `AVLTreeMultiMap` object. It can include properties such as
72
+ * `iterationType` and `variant`, which are used to specify the type of iteration and the variant of
73
+ * the tree, respectively. These properties can be
74
+ * @returns a new instance of the `AVLTreeMultiMap` class, with the provided options merged with the
75
+ * default options. The returned value is casted as `TREE`.
76
+ */
48
77
  createTree(options) {
49
- return new TreeMultimap([], {
78
+ return new AVLTreeMultiMap([], {
50
79
  iterationType: this.iterationType,
51
80
  variant: this.variant,
52
81
  ...options
@@ -89,13 +118,13 @@ export class TreeMultimap extends AVLTree {
89
118
  return node;
90
119
  }
91
120
  /**
92
- * The function checks if an keyOrNodeOrEntry is an instance of the TreeMultimapNode class.
121
+ * The function checks if an keyOrNodeOrEntry is an instance of the AVLTreeMultiMapNode class.
93
122
  * @param keyOrNodeOrEntry - The `keyOrNodeOrEntry` parameter is of type `KeyOrNodeOrEntry<K, V, NODE>`.
94
- * @returns a boolean value indicating whether the keyOrNodeOrEntry is an instance of the TreeMultimapNode
123
+ * @returns a boolean value indicating whether the keyOrNodeOrEntry is an instance of the AVLTreeMultiMapNode
95
124
  * class.
96
125
  */
97
126
  isNode(keyOrNodeOrEntry) {
98
- return keyOrNodeOrEntry instanceof TreeMultimapNode;
127
+ return keyOrNodeOrEntry instanceof AVLTreeMultiMapNode;
99
128
  }
100
129
  /**
101
130
  * Time Complexity: O(log n)
@@ -319,6 +348,14 @@ export class TreeMultimap extends AVLTree {
319
348
  }
320
349
  return undefined;
321
350
  }
351
+ /**
352
+ * The function replaces an old node with a new node and updates the count property of the new node.
353
+ * @param {NODE} oldNode - The `oldNode` parameter is of type `NODE` and represents the node that
354
+ * needs to be replaced in a data structure.
355
+ * @param {NODE} newNode - The `newNode` parameter is an object of type `NODE`.
356
+ * @returns The method is returning the result of calling the `_replaceNode` method from the
357
+ * superclass, after updating the `count` property of the `newNode` object.
358
+ */
322
359
  _replaceNode(oldNode, newNode) {
323
360
  newNode.count = oldNode.count + newNode.count;
324
361
  return super._replaceNode(oldNode, newNode);
@@ -9,8 +9,27 @@ import { BST, BSTNode } from './bst';
9
9
  import type { AVLTreeNested, AVLTreeNodeNested, AVLTreeOptions, BinaryTreeDeleteResult, BSTNKeyOrNode, BTNCallback, KeyOrNodeOrEntry } from '../../types';
10
10
  import { IBinaryTree } from '../../interfaces';
11
11
  export declare class AVLTreeNode<K = any, V = any, NODE extends AVLTreeNode<K, V, NODE> = AVLTreeNodeNested<K, V>> extends BSTNode<K, V, NODE> {
12
- height: number;
12
+ /**
13
+ * The constructor function initializes a new instance of a class with a key and an optional value,
14
+ * and sets the height property to 0.
15
+ * @param {K} key - The "key" parameter is of type K, which represents the type of the key for the
16
+ * constructor. It is used to initialize the key property of the object being created.
17
+ * @param {V} [value] - The "value" parameter is an optional parameter of type V. It represents the
18
+ * value associated with the key in the constructor.
19
+ */
13
20
  constructor(key: K, value?: V);
21
+ protected _height: number;
22
+ /**
23
+ * The function returns the value of the height property.
24
+ * @returns The height of the object.
25
+ */
26
+ get height(): number;
27
+ /**
28
+ * The above function sets the value of the height property.
29
+ * @param {number} value - The value parameter is a number that represents the new height value to be
30
+ * set.
31
+ */
32
+ set height(value: number);
14
33
  }
15
34
  /**
16
35
  * 1. Height-Balanced: Each node's left and right subtrees differ in height by no more than one.
@@ -195,5 +214,14 @@ export declare class AVLTree<K = any, V = any, NODE extends AVLTreeNode<K, V, NO
195
214
  * AVL tree that needs to be balanced.
196
215
  */
197
216
  protected _balancePath(node: KeyOrNodeOrEntry<K, V, NODE>): void;
217
+ /**
218
+ * The function replaces an old node with a new node while preserving the height of the old node.
219
+ * @param {NODE} oldNode - The `oldNode` parameter is the node that you want to replace with the
220
+ * `newNode`.
221
+ * @param {NODE} newNode - The `newNode` parameter is the new node that will replace the `oldNode` in
222
+ * the data structure.
223
+ * @returns the result of calling the `_replaceNode` method on the superclass, passing in the
224
+ * `oldNode` and `newNode` as arguments.
225
+ */
198
226
  protected _replaceNode(oldNode: NODE, newNode: NODE): NODE;
199
227
  }