data-structure-typed 1.49.0 → 1.49.2

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 (195) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/README.md +16 -16
  3. package/README_zh-CN.md +2 -2
  4. package/benchmark/report.html +46 -1
  5. package/benchmark/report.json +457 -22
  6. package/dist/cjs/data-structures/base/iterable-base.d.ts +11 -0
  7. package/dist/cjs/data-structures/base/iterable-base.js +21 -0
  8. package/dist/cjs/data-structures/base/iterable-base.js.map +1 -1
  9. package/dist/cjs/data-structures/binary-tree/avl-tree.d.ts +10 -12
  10. package/dist/cjs/data-structures/binary-tree/avl-tree.js +3 -4
  11. package/dist/cjs/data-structures/binary-tree/avl-tree.js.map +1 -1
  12. package/dist/cjs/data-structures/binary-tree/binary-tree.d.ts +58 -58
  13. package/dist/cjs/data-structures/binary-tree/binary-tree.js +6 -6
  14. package/dist/cjs/data-structures/binary-tree/binary-tree.js.map +1 -1
  15. package/dist/cjs/data-structures/binary-tree/bst.d.ts +15 -15
  16. package/dist/cjs/data-structures/binary-tree/bst.js +3 -3
  17. package/dist/cjs/data-structures/binary-tree/bst.js.map +1 -1
  18. package/dist/cjs/data-structures/binary-tree/rb-tree.d.ts +11 -11
  19. package/dist/cjs/data-structures/binary-tree/rb-tree.js +5 -6
  20. package/dist/cjs/data-structures/binary-tree/rb-tree.js.map +1 -1
  21. package/dist/cjs/data-structures/binary-tree/tree-multimap.d.ts +14 -14
  22. package/dist/cjs/data-structures/binary-tree/tree-multimap.js +3 -3
  23. package/dist/cjs/data-structures/binary-tree/tree-multimap.js.map +1 -1
  24. package/dist/cjs/data-structures/graph/abstract-graph.d.ts +9 -3
  25. package/dist/cjs/data-structures/graph/abstract-graph.js +27 -31
  26. package/dist/cjs/data-structures/graph/abstract-graph.js.map +1 -1
  27. package/dist/cjs/data-structures/graph/directed-graph.d.ts +8 -1
  28. package/dist/cjs/data-structures/graph/directed-graph.js +1 -8
  29. package/dist/cjs/data-structures/graph/directed-graph.js.map +1 -1
  30. package/dist/cjs/data-structures/graph/map-graph.d.ts +1 -1
  31. package/dist/cjs/data-structures/graph/undirected-graph.d.ts +8 -1
  32. package/dist/cjs/data-structures/graph/undirected-graph.js +1 -8
  33. package/dist/cjs/data-structures/graph/undirected-graph.js.map +1 -1
  34. package/dist/cjs/data-structures/hash/hash-map.d.ts +22 -10
  35. package/dist/cjs/data-structures/hash/hash-map.js +28 -16
  36. package/dist/cjs/data-structures/hash/hash-map.js.map +1 -1
  37. package/dist/cjs/data-structures/hash/hash-table.d.ts +2 -2
  38. package/dist/cjs/data-structures/hash/hash-table.js.map +1 -1
  39. package/dist/cjs/data-structures/heap/heap.d.ts +20 -38
  40. package/dist/cjs/data-structures/heap/heap.js +22 -42
  41. package/dist/cjs/data-structures/heap/heap.js.map +1 -1
  42. package/dist/cjs/data-structures/heap/max-heap.d.ts +11 -1
  43. package/dist/cjs/data-structures/heap/max-heap.js +10 -7
  44. package/dist/cjs/data-structures/heap/max-heap.js.map +1 -1
  45. package/dist/cjs/data-structures/heap/min-heap.d.ts +11 -1
  46. package/dist/cjs/data-structures/heap/min-heap.js +10 -7
  47. package/dist/cjs/data-structures/heap/min-heap.js.map +1 -1
  48. package/dist/cjs/data-structures/linked-list/doubly-linked-list.d.ts +95 -95
  49. package/dist/cjs/data-structures/linked-list/doubly-linked-list.js +132 -136
  50. package/dist/cjs/data-structures/linked-list/doubly-linked-list.js.map +1 -1
  51. package/dist/cjs/data-structures/linked-list/singly-linked-list.d.ts +18 -23
  52. package/dist/cjs/data-structures/linked-list/singly-linked-list.js +42 -49
  53. package/dist/cjs/data-structures/linked-list/singly-linked-list.js.map +1 -1
  54. package/dist/cjs/data-structures/linked-list/skip-linked-list.d.ts +2 -2
  55. package/dist/cjs/data-structures/linked-list/skip-linked-list.js +2 -2
  56. package/dist/cjs/data-structures/linked-list/skip-linked-list.js.map +1 -1
  57. package/dist/cjs/data-structures/priority-queue/max-priority-queue.d.ts +1 -1
  58. package/dist/cjs/data-structures/priority-queue/max-priority-queue.js +0 -7
  59. package/dist/cjs/data-structures/priority-queue/max-priority-queue.js.map +1 -1
  60. package/dist/cjs/data-structures/priority-queue/min-priority-queue.d.ts +1 -1
  61. package/dist/cjs/data-structures/priority-queue/min-priority-queue.js +0 -7
  62. package/dist/cjs/data-structures/priority-queue/min-priority-queue.js.map +1 -1
  63. package/dist/cjs/data-structures/priority-queue/priority-queue.d.ts +9 -1
  64. package/dist/cjs/data-structures/priority-queue/priority-queue.js +8 -7
  65. package/dist/cjs/data-structures/priority-queue/priority-queue.js.map +1 -1
  66. package/dist/cjs/data-structures/queue/deque.d.ts +76 -80
  67. package/dist/cjs/data-structures/queue/deque.js +106 -122
  68. package/dist/cjs/data-structures/queue/deque.js.map +1 -1
  69. package/dist/cjs/data-structures/queue/queue.d.ts +30 -16
  70. package/dist/cjs/data-structures/queue/queue.js +31 -24
  71. package/dist/cjs/data-structures/queue/queue.js.map +1 -1
  72. package/dist/cjs/data-structures/stack/stack.d.ts +17 -8
  73. package/dist/cjs/data-structures/stack/stack.js +9 -9
  74. package/dist/cjs/data-structures/stack/stack.js.map +1 -1
  75. package/dist/cjs/data-structures/trie/trie.d.ts +14 -5
  76. package/dist/cjs/data-structures/trie/trie.js +13 -13
  77. package/dist/cjs/data-structures/trie/trie.js.map +1 -1
  78. package/dist/cjs/interfaces/binary-tree.d.ts +4 -4
  79. package/dist/cjs/types/common.d.ts +32 -8
  80. package/dist/cjs/types/common.js +22 -1
  81. package/dist/cjs/types/common.js.map +1 -1
  82. package/dist/cjs/types/data-structures/binary-tree/binary-tree.d.ts +1 -24
  83. package/dist/cjs/types/data-structures/binary-tree/binary-tree.js +0 -22
  84. package/dist/cjs/types/data-structures/binary-tree/binary-tree.js.map +1 -1
  85. package/dist/cjs/types/data-structures/binary-tree/rb-tree.d.ts +1 -1
  86. package/dist/cjs/types/data-structures/binary-tree/tree-multimap.d.ts +1 -1
  87. package/dist/mjs/data-structures/base/iterable-base.d.ts +11 -0
  88. package/dist/mjs/data-structures/base/iterable-base.js +21 -0
  89. package/dist/mjs/data-structures/binary-tree/avl-tree.d.ts +10 -12
  90. package/dist/mjs/data-structures/binary-tree/avl-tree.js +3 -4
  91. package/dist/mjs/data-structures/binary-tree/binary-tree.d.ts +58 -58
  92. package/dist/mjs/data-structures/binary-tree/binary-tree.js +6 -6
  93. package/dist/mjs/data-structures/binary-tree/bst.d.ts +15 -15
  94. package/dist/mjs/data-structures/binary-tree/bst.js +3 -3
  95. package/dist/mjs/data-structures/binary-tree/rb-tree.d.ts +11 -11
  96. package/dist/mjs/data-structures/binary-tree/rb-tree.js +5 -6
  97. package/dist/mjs/data-structures/binary-tree/tree-multimap.d.ts +14 -14
  98. package/dist/mjs/data-structures/binary-tree/tree-multimap.js +3 -3
  99. package/dist/mjs/data-structures/graph/abstract-graph.d.ts +9 -3
  100. package/dist/mjs/data-structures/graph/abstract-graph.js +27 -31
  101. package/dist/mjs/data-structures/graph/directed-graph.d.ts +8 -1
  102. package/dist/mjs/data-structures/graph/directed-graph.js +1 -8
  103. package/dist/mjs/data-structures/graph/map-graph.d.ts +1 -1
  104. package/dist/mjs/data-structures/graph/undirected-graph.d.ts +8 -1
  105. package/dist/mjs/data-structures/graph/undirected-graph.js +1 -8
  106. package/dist/mjs/data-structures/hash/hash-map.d.ts +22 -10
  107. package/dist/mjs/data-structures/hash/hash-map.js +27 -15
  108. package/dist/mjs/data-structures/hash/hash-table.d.ts +2 -2
  109. package/dist/mjs/data-structures/heap/heap.d.ts +20 -38
  110. package/dist/mjs/data-structures/heap/heap.js +23 -43
  111. package/dist/mjs/data-structures/heap/max-heap.d.ts +11 -1
  112. package/dist/mjs/data-structures/heap/max-heap.js +9 -6
  113. package/dist/mjs/data-structures/heap/min-heap.d.ts +11 -1
  114. package/dist/mjs/data-structures/heap/min-heap.js +9 -6
  115. package/dist/mjs/data-structures/linked-list/doubly-linked-list.d.ts +95 -95
  116. package/dist/mjs/data-structures/linked-list/doubly-linked-list.js +132 -136
  117. package/dist/mjs/data-structures/linked-list/singly-linked-list.d.ts +18 -23
  118. package/dist/mjs/data-structures/linked-list/singly-linked-list.js +43 -50
  119. package/dist/mjs/data-structures/linked-list/skip-linked-list.d.ts +2 -2
  120. package/dist/mjs/data-structures/linked-list/skip-linked-list.js +2 -2
  121. package/dist/mjs/data-structures/priority-queue/max-priority-queue.d.ts +1 -1
  122. package/dist/mjs/data-structures/priority-queue/max-priority-queue.js +0 -7
  123. package/dist/mjs/data-structures/priority-queue/min-priority-queue.d.ts +1 -1
  124. package/dist/mjs/data-structures/priority-queue/min-priority-queue.js +0 -7
  125. package/dist/mjs/data-structures/priority-queue/priority-queue.d.ts +9 -1
  126. package/dist/mjs/data-structures/priority-queue/priority-queue.js +7 -6
  127. package/dist/mjs/data-structures/queue/deque.d.ts +76 -80
  128. package/dist/mjs/data-structures/queue/deque.js +106 -122
  129. package/dist/mjs/data-structures/queue/queue.d.ts +30 -16
  130. package/dist/mjs/data-structures/queue/queue.js +31 -24
  131. package/dist/mjs/data-structures/stack/stack.d.ts +17 -8
  132. package/dist/mjs/data-structures/stack/stack.js +10 -10
  133. package/dist/mjs/data-structures/trie/trie.d.ts +14 -5
  134. package/dist/mjs/data-structures/trie/trie.js +14 -14
  135. package/dist/mjs/interfaces/binary-tree.d.ts +4 -4
  136. package/dist/mjs/types/common.d.ts +32 -8
  137. package/dist/mjs/types/common.js +21 -0
  138. package/dist/mjs/types/data-structures/binary-tree/binary-tree.d.ts +1 -24
  139. package/dist/mjs/types/data-structures/binary-tree/binary-tree.js +1 -21
  140. package/dist/mjs/types/data-structures/binary-tree/rb-tree.d.ts +1 -1
  141. package/dist/mjs/types/data-structures/binary-tree/tree-multimap.d.ts +1 -1
  142. package/dist/umd/data-structure-typed.js +533 -558
  143. package/dist/umd/data-structure-typed.min.js +2 -2
  144. package/dist/umd/data-structure-typed.min.js.map +1 -1
  145. package/package.json +1 -1
  146. package/src/data-structures/base/iterable-base.ts +24 -0
  147. package/src/data-structures/binary-tree/avl-tree.ts +14 -14
  148. package/src/data-structures/binary-tree/binary-tree.ts +74 -77
  149. package/src/data-structures/binary-tree/bst.ts +18 -17
  150. package/src/data-structures/binary-tree/rb-tree.ts +17 -18
  151. package/src/data-structures/binary-tree/tree-multimap.ts +22 -20
  152. package/src/data-structures/graph/abstract-graph.ts +35 -25
  153. package/src/data-structures/graph/directed-graph.ts +2 -2
  154. package/src/data-structures/graph/map-graph.ts +1 -1
  155. package/src/data-structures/graph/undirected-graph.ts +2 -2
  156. package/src/data-structures/hash/hash-map.ts +40 -24
  157. package/src/data-structures/hash/hash-table.ts +3 -3
  158. package/src/data-structures/heap/heap.ts +33 -60
  159. package/src/data-structures/heap/max-heap.ts +11 -2
  160. package/src/data-structures/heap/min-heap.ts +11 -2
  161. package/src/data-structures/linked-list/doubly-linked-list.ts +147 -145
  162. package/src/data-structures/linked-list/singly-linked-list.ts +52 -52
  163. package/src/data-structures/linked-list/skip-linked-list.ts +2 -2
  164. package/src/data-structures/priority-queue/max-priority-queue.ts +1 -1
  165. package/src/data-structures/priority-queue/min-priority-queue.ts +1 -1
  166. package/src/data-structures/priority-queue/priority-queue.ts +9 -2
  167. package/src/data-structures/queue/deque.ts +129 -144
  168. package/src/data-structures/queue/queue.ts +37 -26
  169. package/src/data-structures/stack/stack.ts +20 -14
  170. package/src/data-structures/trie/trie.ts +18 -13
  171. package/src/interfaces/binary-tree.ts +5 -5
  172. package/src/types/common.ts +37 -12
  173. package/src/types/data-structures/binary-tree/avl-tree.ts +0 -1
  174. package/src/types/data-structures/binary-tree/binary-tree.ts +1 -26
  175. package/src/types/data-structures/binary-tree/bst.ts +0 -1
  176. package/src/types/data-structures/binary-tree/rb-tree.ts +1 -1
  177. package/src/types/data-structures/binary-tree/tree-multimap.ts +1 -1
  178. package/test/performance/data-structures/comparison/comparison.test.ts +6 -6
  179. package/test/performance/data-structures/heap/heap.test.ts +2 -2
  180. package/test/performance/data-structures/linked-list/doubly-linked-list.test.ts +2 -2
  181. package/test/performance/data-structures/linked-list/singly-linked-list.test.ts +2 -2
  182. package/test/performance/data-structures/priority-queue/priority-queue.test.ts +2 -2
  183. package/test/unit/data-structures/binary-tree/binary-tree.test.ts +2 -2
  184. package/test/unit/data-structures/graph/directed-graph.test.ts +21 -1
  185. package/test/unit/data-structures/graph/undirected-graph.test.ts +39 -1
  186. package/test/unit/data-structures/hash/hash-map.test.ts +2 -2
  187. package/test/unit/data-structures/heap/heap.test.ts +1 -1
  188. package/test/unit/data-structures/heap/min-heap.test.ts +1 -1
  189. package/test/unit/data-structures/linked-list/doubly-linked-list.test.ts +30 -30
  190. package/test/unit/data-structures/linked-list/linked-list.test.ts +1 -1
  191. package/test/unit/data-structures/linked-list/singly-linked-list.test.ts +21 -21
  192. package/test/unit/data-structures/linked-list/skip-list.test.ts +2 -2
  193. package/test/unit/data-structures/queue/deque.test.ts +5 -5
  194. package/test/unit/data-structures/queue/queue.test.ts +4 -4
  195. package/test/unit/data-structures/trie/trie.test.ts +1 -1
@@ -1,55 +1,490 @@
1
1
  {
2
+ "avl-tree": {
3
+ "benchmarks": [
4
+ {
5
+ "test name": "10,000 add randomly",
6
+ "time taken (ms)": "50.74",
7
+ "executions per sec": "19.71",
8
+ "sample deviation": "0.00"
9
+ },
10
+ {
11
+ "test name": "10,000 add & delete randomly",
12
+ "time taken (ms)": "127.76",
13
+ "executions per sec": "7.83",
14
+ "sample deviation": "0.02"
15
+ },
16
+ {
17
+ "test name": "10,000 addMany",
18
+ "time taken (ms)": "57.14",
19
+ "executions per sec": "17.50",
20
+ "sample deviation": "0.00"
21
+ },
22
+ {
23
+ "test name": "10,000 get",
24
+ "time taken (ms)": "52.22",
25
+ "executions per sec": "19.15",
26
+ "sample deviation": "0.01"
27
+ }
28
+ ],
29
+ "testName": "avl-tree"
30
+ },
2
31
  "binary-tree": {
3
32
  "benchmarks": [
4
33
  {
5
34
  "test name": "1,000 add randomly",
6
- "time taken (ms)": "17.61",
7
- "executions per sec": "56.79",
8
- "sample deviation": "4.75e-4"
35
+ "time taken (ms)": "18.32",
36
+ "executions per sec": "54.59",
37
+ "sample deviation": "0.00"
9
38
  },
10
39
  {
11
40
  "test name": "1,000 add & delete randomly",
12
- "time taken (ms)": "23.21",
13
- "executions per sec": "43.08",
14
- "sample deviation": "0.00"
41
+ "time taken (ms)": "26.54",
42
+ "executions per sec": "37.69",
43
+ "sample deviation": "0.01"
15
44
  },
16
45
  {
17
46
  "test name": "1,000 addMany",
18
- "time taken (ms)": "17.89",
19
- "executions per sec": "55.90",
47
+ "time taken (ms)": "18.79",
48
+ "executions per sec": "53.22",
20
49
  "sample deviation": "0.00"
21
50
  },
22
51
  {
23
52
  "test name": "1,000 get",
24
- "time taken (ms)": "17.71",
25
- "executions per sec": "56.47",
53
+ "time taken (ms)": "18.95",
54
+ "executions per sec": "52.78",
26
55
  "sample deviation": "0.00"
27
56
  },
28
57
  {
29
58
  "test name": "1,000 has",
30
- "time taken (ms)": "17.15",
31
- "executions per sec": "58.30",
32
- "sample deviation": "2.88e-4"
59
+ "time taken (ms)": "19.76",
60
+ "executions per sec": "50.60",
61
+ "sample deviation": "0.01"
33
62
  },
34
63
  {
35
64
  "test name": "1,000 dfs",
36
- "time taken (ms)": "161.44",
37
- "executions per sec": "6.19",
38
- "sample deviation": "0.00"
65
+ "time taken (ms)": "159.96",
66
+ "executions per sec": "6.25",
67
+ "sample deviation": "0.01"
39
68
  },
40
69
  {
41
70
  "test name": "1,000 bfs",
42
- "time taken (ms)": "57.53",
43
- "executions per sec": "17.38",
44
- "sample deviation": "0.00"
71
+ "time taken (ms)": "73.63",
72
+ "executions per sec": "13.58",
73
+ "sample deviation": "0.08"
45
74
  },
46
75
  {
47
76
  "test name": "1,000 morris",
48
- "time taken (ms)": "258.22",
49
- "executions per sec": "3.87",
50
- "sample deviation": "0.00"
77
+ "time taken (ms)": "225.93",
78
+ "executions per sec": "4.43",
79
+ "sample deviation": "0.05"
51
80
  }
52
81
  ],
53
82
  "testName": "binary-tree"
83
+ },
84
+ "bst": {
85
+ "benchmarks": [
86
+ {
87
+ "test name": "10,000 add randomly",
88
+ "time taken (ms)": "48.80",
89
+ "executions per sec": "20.49",
90
+ "sample deviation": "2.79e-4"
91
+ },
92
+ {
93
+ "test name": "10,000 add & delete randomly",
94
+ "time taken (ms)": "110.72",
95
+ "executions per sec": "9.03",
96
+ "sample deviation": "0.00"
97
+ },
98
+ {
99
+ "test name": "10,000 addMany",
100
+ "time taken (ms)": "46.19",
101
+ "executions per sec": "21.65",
102
+ "sample deviation": "0.00"
103
+ },
104
+ {
105
+ "test name": "10,000 get",
106
+ "time taken (ms)": "49.28",
107
+ "executions per sec": "20.29",
108
+ "sample deviation": "7.92e-4"
109
+ }
110
+ ],
111
+ "testName": "bst"
112
+ },
113
+ "rb-tree": {
114
+ "benchmarks": [
115
+ {
116
+ "test name": "100,000 add",
117
+ "time taken (ms)": "80.84",
118
+ "executions per sec": "12.37",
119
+ "sample deviation": "0.00"
120
+ },
121
+ {
122
+ "test name": "100,000 add & delete randomly",
123
+ "time taken (ms)": "206.65",
124
+ "executions per sec": "4.84",
125
+ "sample deviation": "0.01"
126
+ },
127
+ {
128
+ "test name": "100,000 getNode",
129
+ "time taken (ms)": "57.42",
130
+ "executions per sec": "17.42",
131
+ "sample deviation": "0.00"
132
+ },
133
+ {
134
+ "test name": "100,000 add & iterator",
135
+ "time taken (ms)": "109.59",
136
+ "executions per sec": "9.12",
137
+ "sample deviation": "0.00"
138
+ }
139
+ ],
140
+ "testName": "rb-tree"
141
+ },
142
+ "comparison": {
143
+ "benchmarks": [
144
+ {
145
+ "test name": "SRC PQ 10,000 add",
146
+ "time taken (ms)": "0.14",
147
+ "executions per sec": "6917.74",
148
+ "sample deviation": "1.81e-6"
149
+ },
150
+ {
151
+ "test name": "CJS PQ 10,000 add",
152
+ "time taken (ms)": "0.15",
153
+ "executions per sec": "6883.53",
154
+ "sample deviation": "3.84e-6"
155
+ },
156
+ {
157
+ "test name": "MJS PQ 10,000 add",
158
+ "time taken (ms)": "0.57",
159
+ "executions per sec": "1761.70",
160
+ "sample deviation": "5.07e-6"
161
+ },
162
+ {
163
+ "test name": "SRC PQ 10,000 add & poll",
164
+ "time taken (ms)": "3.45",
165
+ "executions per sec": "289.74",
166
+ "sample deviation": "3.63e-4"
167
+ },
168
+ {
169
+ "test name": "CJS PQ 10,000 add & poll",
170
+ "time taken (ms)": "3.53",
171
+ "executions per sec": "283.14",
172
+ "sample deviation": "4.73e-5"
173
+ },
174
+ {
175
+ "test name": "MJS PQ 10,000 add & poll",
176
+ "time taken (ms)": "3.31",
177
+ "executions per sec": "302.38",
178
+ "sample deviation": "3.64e-5"
179
+ }
180
+ ],
181
+ "testName": "comparison"
182
+ },
183
+ "directed-graph": {
184
+ "benchmarks": [
185
+ {
186
+ "test name": "1,000 addVertex",
187
+ "time taken (ms)": "0.10",
188
+ "executions per sec": "9860.53",
189
+ "sample deviation": "9.32e-7"
190
+ },
191
+ {
192
+ "test name": "1,000 addEdge",
193
+ "time taken (ms)": "6.34",
194
+ "executions per sec": "157.71",
195
+ "sample deviation": "8.55e-4"
196
+ },
197
+ {
198
+ "test name": "1,000 getVertex",
199
+ "time taken (ms)": "0.05",
200
+ "executions per sec": "2.16e+4",
201
+ "sample deviation": "4.61e-7"
202
+ },
203
+ {
204
+ "test name": "1,000 getEdge",
205
+ "time taken (ms)": "22.67",
206
+ "executions per sec": "44.12",
207
+ "sample deviation": "0.00"
208
+ },
209
+ {
210
+ "test name": "tarjan",
211
+ "time taken (ms)": "217.59",
212
+ "executions per sec": "4.60",
213
+ "sample deviation": "0.01"
214
+ },
215
+ {
216
+ "test name": "tarjan all",
217
+ "time taken (ms)": "6489.86",
218
+ "executions per sec": "0.15",
219
+ "sample deviation": "0.09"
220
+ },
221
+ {
222
+ "test name": "topologicalSort",
223
+ "time taken (ms)": "179.22",
224
+ "executions per sec": "5.58",
225
+ "sample deviation": "0.00"
226
+ }
227
+ ],
228
+ "testName": "directed-graph"
229
+ },
230
+ "hash-map": {
231
+ "benchmarks": [
232
+ {
233
+ "test name": "1,000,000 set",
234
+ "time taken (ms)": "108.75",
235
+ "executions per sec": "9.20",
236
+ "sample deviation": "0.04"
237
+ },
238
+ {
239
+ "test name": "Native Map 1,000,000 set",
240
+ "time taken (ms)": "217.55",
241
+ "executions per sec": "4.60",
242
+ "sample deviation": "0.02"
243
+ },
244
+ {
245
+ "test name": "Native Set 1,000,000 add",
246
+ "time taken (ms)": "179.67",
247
+ "executions per sec": "5.57",
248
+ "sample deviation": "0.03"
249
+ },
250
+ {
251
+ "test name": "1,000,000 set & get",
252
+ "time taken (ms)": "122.66",
253
+ "executions per sec": "8.15",
254
+ "sample deviation": "0.03"
255
+ },
256
+ {
257
+ "test name": "Native Map 1,000,000 set & get",
258
+ "time taken (ms)": "282.47",
259
+ "executions per sec": "3.54",
260
+ "sample deviation": "0.04"
261
+ },
262
+ {
263
+ "test name": "Native Set 1,000,000 add & has",
264
+ "time taken (ms)": "174.48",
265
+ "executions per sec": "5.73",
266
+ "sample deviation": "0.02"
267
+ },
268
+ {
269
+ "test name": "1,000,000 ObjKey set & get",
270
+ "time taken (ms)": "336.83",
271
+ "executions per sec": "2.97",
272
+ "sample deviation": "0.06"
273
+ },
274
+ {
275
+ "test name": "Native Map 1,000,000 ObjKey set & get",
276
+ "time taken (ms)": "314.00",
277
+ "executions per sec": "3.18",
278
+ "sample deviation": "0.06"
279
+ },
280
+ {
281
+ "test name": "Native Set 1,000,000 ObjKey add & has",
282
+ "time taken (ms)": "267.84",
283
+ "executions per sec": "3.73",
284
+ "sample deviation": "0.03"
285
+ }
286
+ ],
287
+ "testName": "hash-map"
288
+ },
289
+ "heap": {
290
+ "benchmarks": [
291
+ {
292
+ "test name": "100,000 add & poll",
293
+ "time taken (ms)": "80.49",
294
+ "executions per sec": "12.42",
295
+ "sample deviation": "0.00"
296
+ },
297
+ {
298
+ "test name": "100,000 add & dfs",
299
+ "time taken (ms)": "34.01",
300
+ "executions per sec": "29.40",
301
+ "sample deviation": "3.88e-4"
302
+ },
303
+ {
304
+ "test name": "10,000 fib add & pop",
305
+ "time taken (ms)": "359.70",
306
+ "executions per sec": "2.78",
307
+ "sample deviation": "0.00"
308
+ }
309
+ ],
310
+ "testName": "heap"
311
+ },
312
+ "doubly-linked-list": {
313
+ "benchmarks": [
314
+ {
315
+ "test name": "1,000,000 push",
316
+ "time taken (ms)": "229.17",
317
+ "executions per sec": "4.36",
318
+ "sample deviation": "0.06"
319
+ },
320
+ {
321
+ "test name": "1,000,000 unshift",
322
+ "time taken (ms)": "220.53",
323
+ "executions per sec": "4.53",
324
+ "sample deviation": "0.06"
325
+ },
326
+ {
327
+ "test name": "1,000,000 unshift & shift",
328
+ "time taken (ms)": "172.12",
329
+ "executions per sec": "5.81",
330
+ "sample deviation": "0.03"
331
+ },
332
+ {
333
+ "test name": "1,000,000 addBefore",
334
+ "time taken (ms)": "309.58",
335
+ "executions per sec": "3.23",
336
+ "sample deviation": "0.06"
337
+ }
338
+ ],
339
+ "testName": "doubly-linked-list"
340
+ },
341
+ "singly-linked-list": {
342
+ "benchmarks": [
343
+ {
344
+ "test name": "1,000,000 push & shift",
345
+ "time taken (ms)": "211.62",
346
+ "executions per sec": "4.73",
347
+ "sample deviation": "0.06"
348
+ },
349
+ {
350
+ "test name": "10,000 push & pop",
351
+ "time taken (ms)": "219.72",
352
+ "executions per sec": "4.55",
353
+ "sample deviation": "0.03"
354
+ },
355
+ {
356
+ "test name": "10,000 addBefore",
357
+ "time taken (ms)": "249.09",
358
+ "executions per sec": "4.01",
359
+ "sample deviation": "0.01"
360
+ }
361
+ ],
362
+ "testName": "singly-linked-list"
363
+ },
364
+ "max-priority-queue": {
365
+ "benchmarks": [
366
+ {
367
+ "test name": "10,000 refill & poll",
368
+ "time taken (ms)": "8.96",
369
+ "executions per sec": "111.61",
370
+ "sample deviation": "1.80e-4"
371
+ }
372
+ ],
373
+ "testName": "max-priority-queue"
374
+ },
375
+ "priority-queue": {
376
+ "benchmarks": [
377
+ {
378
+ "test name": "100,000 add & poll",
379
+ "time taken (ms)": "106.14",
380
+ "executions per sec": "9.42",
381
+ "sample deviation": "0.00"
382
+ }
383
+ ],
384
+ "testName": "priority-queue"
385
+ },
386
+ "deque": {
387
+ "benchmarks": [
388
+ {
389
+ "test name": "1,000,000 push",
390
+ "time taken (ms)": "13.91",
391
+ "executions per sec": "71.89",
392
+ "sample deviation": "4.15e-4"
393
+ },
394
+ {
395
+ "test name": "1,000,000 push & pop",
396
+ "time taken (ms)": "22.82",
397
+ "executions per sec": "43.83",
398
+ "sample deviation": "2.45e-4"
399
+ },
400
+ {
401
+ "test name": "100,000 push & shift",
402
+ "time taken (ms)": "2.38",
403
+ "executions per sec": "420.49",
404
+ "sample deviation": "3.61e-5"
405
+ },
406
+ {
407
+ "test name": "Native Array 100,000 push & shift",
408
+ "time taken (ms)": "2718.62",
409
+ "executions per sec": "0.37",
410
+ "sample deviation": "0.35"
411
+ },
412
+ {
413
+ "test name": "100,000 unshift & shift",
414
+ "time taken (ms)": "2.28",
415
+ "executions per sec": "438.78",
416
+ "sample deviation": "4.18e-4"
417
+ },
418
+ {
419
+ "test name": "Native Array 100,000 unshift & shift",
420
+ "time taken (ms)": "4065.01",
421
+ "executions per sec": "0.25",
422
+ "sample deviation": "0.21"
423
+ }
424
+ ],
425
+ "testName": "deque"
426
+ },
427
+ "queue": {
428
+ "benchmarks": [
429
+ {
430
+ "test name": "1,000,000 push",
431
+ "time taken (ms)": "44.46",
432
+ "executions per sec": "22.49",
433
+ "sample deviation": "0.01"
434
+ },
435
+ {
436
+ "test name": "100,000 push & shift",
437
+ "time taken (ms)": "5.16",
438
+ "executions per sec": "193.83",
439
+ "sample deviation": "0.00"
440
+ },
441
+ {
442
+ "test name": "Native Array 100,000 push & shift",
443
+ "time taken (ms)": "2195.56",
444
+ "executions per sec": "0.46",
445
+ "sample deviation": "0.29"
446
+ },
447
+ {
448
+ "test name": "Native Array 100,000 push & pop",
449
+ "time taken (ms)": "4.40",
450
+ "executions per sec": "227.04",
451
+ "sample deviation": "0.00"
452
+ }
453
+ ],
454
+ "testName": "queue"
455
+ },
456
+ "stack": {
457
+ "benchmarks": [
458
+ {
459
+ "test name": "1,000,000 push",
460
+ "time taken (ms)": "44.05",
461
+ "executions per sec": "22.70",
462
+ "sample deviation": "0.01"
463
+ },
464
+ {
465
+ "test name": "1,000,000 push & pop",
466
+ "time taken (ms)": "49.72",
467
+ "executions per sec": "20.11",
468
+ "sample deviation": "0.01"
469
+ }
470
+ ],
471
+ "testName": "stack"
472
+ },
473
+ "trie": {
474
+ "benchmarks": [
475
+ {
476
+ "test name": "100,000 push",
477
+ "time taken (ms)": "44.33",
478
+ "executions per sec": "22.56",
479
+ "sample deviation": "0.00"
480
+ },
481
+ {
482
+ "test name": "100,000 getWords",
483
+ "time taken (ms)": "88.47",
484
+ "executions per sec": "11.30",
485
+ "sample deviation": "0.01"
486
+ }
487
+ ],
488
+ "testName": "trie"
54
489
  }
55
490
  }
@@ -126,6 +126,12 @@ export declare abstract class IterableEntryBase<K = any, V = any> {
126
126
  * all the elements in the collection.
127
127
  */
128
128
  reduce<U>(callbackfn: ReduceEntryCallback<K, V, U>, initialValue: U): U;
129
+ hasValue(value: V): boolean;
130
+ /**
131
+ * Time Complexity: O(n)
132
+ * Space Complexity: O(n)
133
+ */
134
+ print(): void;
129
135
  protected abstract _getIterator(...args: any[]): IterableIterator<[K, V]>;
130
136
  }
131
137
  export declare abstract class IterableElementBase<V> {
@@ -228,5 +234,10 @@ export declare abstract class IterableElementBase<V> {
228
234
  * all the elements in the array and applying the callback function to each element.
229
235
  */
230
236
  reduce<U>(callbackfn: ReduceElementCallback<V, U>, initialValue: U): U;
237
+ /**
238
+ * Time Complexity: O(n)
239
+ * Space Complexity: O(n)
240
+ */
241
+ print(): void;
231
242
  protected abstract _getIterator(...args: any[]): IterableIterator<V>;
232
243
  }
@@ -172,6 +172,20 @@ class IterableEntryBase {
172
172
  }
173
173
  return accumulator;
174
174
  }
175
+ hasValue(value) {
176
+ for (const [, elementValue] of this) {
177
+ if (elementValue === value)
178
+ return true;
179
+ }
180
+ return false;
181
+ }
182
+ /**
183
+ * Time Complexity: O(n)
184
+ * Space Complexity: O(n)
185
+ */
186
+ print() {
187
+ console.log([...this]);
188
+ }
175
189
  }
176
190
  exports.IterableEntryBase = IterableEntryBase;
177
191
  class IterableElementBase {
@@ -308,6 +322,13 @@ class IterableElementBase {
308
322
  }
309
323
  return accumulator;
310
324
  }
325
+ /**
326
+ * Time Complexity: O(n)
327
+ * Space Complexity: O(n)
328
+ */
329
+ print() {
330
+ console.log([...this]);
331
+ }
311
332
  }
312
333
  exports.IterableElementBase = IterableElementBase;
313
334
  //# sourceMappingURL=iterable-base.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"iterable-base.js","sourceRoot":"","sources":["../../../../src/data-structures/base/iterable-base.ts"],"names":[],"mappings":";;;AAEA,MAAsB,iBAAiB;IAErC;;;OAGG;IAEH;;;;;;;;OAQG;IACH,CAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,GAAG,IAAW;QAChC,KAAK,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC,CAAC;IACpC,CAAC;IAED;;;OAGG;IACH;;;;;;OAMG;IACH,CAAE,OAAO;QACP,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE,CAAC;YACxB,MAAM,IAAI,CAAC;QACb,CAAC;IACH,CAAC;IAED;;;OAGG;IACH;;;;;OAKG;IACH,CAAE,IAAI;QACJ,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE,CAAC;YACxB,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC;QAChB,CAAC;IACH,CAAC;IAED;;;OAGG;IACH;;;;;OAKG;IACH,CAAE,MAAM;QACN,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE,CAAC;YACxB,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC;QAChB,CAAC;I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AS,EAAE,KAAK,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC;gBACtD,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;OAGG;IACH;;;;;;;;;;;;OAYG;IACH,OAAO,CAAC,UAAoC,EAAE,OAAa;QACzD,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE,CAAC;YACxB,UAAU,CAAC,IAAI,CAAC,OAAO,EAAE,IAAS,EAAE,KAAK,EAAE,EAAE,IAAI,CAAC,CAAA;QACpD,CAAC;IACH,CAAC;IAED;;;OAGG;IACH;;;;;;;;;;;;OAYG;IACH,MAAM,CAAI,UAAuC,EAAE,YAAe;QAChE,IAAI,WAAW,GAAG,YAAY,CAAC;QAC/B,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE,CAAC;YACxB,WAAW,GAAG,UAAU,CAAC,WAAW,EAAE,IAAS,EAAE,KAAK,EAAE,EAAE,IAAI,CAAC,CAAA;QACjE,CAAC;QACD,OAAO,WAAW,CAAC;IACrB,CAAC;CAGF;AA9ID,kDA8IC"}
1
+ {"version":3,"file":"iterable-base.js","sourceRoot":"","sources":["../../../../src/data-structures/base/iterable-base.ts"],"names":[],"mappings":";;;AAEA,MAAsB,iBAAiB;IAErC;;;OAGG;IAEH;;;;;;;;OAQG;IACH,CAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,GAAG,IAAW;QAChC,KAAK,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC,CAAC;IACpC,CAAC;IAED;;;OAGG;IACH;;;;;;OAMG;IACH,CAAE,OAAO;QACP,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE,CAAC;YACxB,MAAM,IAAI,CAAC;QACb,CAAC;IACH,CAAC;IAED;;;OAGG;IACH;;;;;OAKG;IACH,CAAE,IAAI;QACJ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AA;QACjE,CAAC;QACD,OAAO,WAAW,CAAC;IACrB,CAAC;IAGD;;;OAGG;IACH,KAAK;QACH,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAA;IACxB,CAAC;CAGF;AAvJD,kDAuJC"}
@@ -6,8 +6,7 @@
6
6
  * @license MIT License
7
7
  */
8
8
  import { BST, BSTNode } from './bst';
9
- import type { AVLTreeNested, AVLTreeNodeNested, AVLTreeOptions, BiTreeDeleteResult, BSTNodeKeyOrNode, BTNodeExemplar } from '../../types';
10
- import { BTNCallback, BTNodeKeyOrNode } from '../../types';
9
+ import type { AVLTreeNested, AVLTreeNodeNested, AVLTreeOptions, BinaryTreeDeleteResult, BSTNKeyOrNode, BTNCallback, BTNExemplar, BTNKeyOrNode } from '../../types';
11
10
  import { IBinaryTree } from '../../interfaces';
12
11
  export declare class AVLTreeNode<K = any, V = any, N extends AVLTreeNode<K, V, N> = AVLTreeNodeNested<K, V>> extends BSTNode<K, V, N> {
13
12
  height: number;
@@ -21,19 +20,18 @@ export declare class AVLTreeNode<K = any, V = any, N extends AVLTreeNode<K, V, N
21
20
  * 5. Efficient Lookups: Offers O(log n) search time, where 'n' is the number of nodes, due to its balanced nature.
22
21
  * 6. Complex Insertions and Deletions: Due to rebalancing, these operations are more complex than in a regular BST.
23
22
  * 7. Path Length: The path length from the root to any leaf is longer compared to an unbalanced BST, but shorter than a linear chain of nodes.
24
- * 8. Memory Overhead: Stores balance factors (or heights) at each node, leading to slightly higher memory usage compared to a regular BST.
25
23
  */
26
24
  export declare class AVLTree<K = any, V = any, N extends AVLTreeNode<K, V, N> = AVLTreeNode<K, V, AVLTreeNodeNested<K, V>>, TREE extends AVLTree<K, V, N, TREE> = AVLTree<K, V, N, AVLTreeNested<K, V, N>>> extends BST<K, V, N, TREE> implements IBinaryTree<K, V, N, TREE> {
27
25
  /**
28
26
  * The constructor function initializes an AVLTree object with optional elements and options.
29
- * @param [elements] - The `elements` parameter is an optional iterable of `BTNodeExemplar<K, V, N>`
27
+ * @param [elements] - The `elements` parameter is an optional iterable of `BTNExemplar<K, V, N>`
30
28
  * objects. It represents a collection of elements that will be added to the AVL tree during
31
29
  * initialization.
32
30
  * @param [options] - The `options` parameter is an optional object that allows you to customize the
33
31
  * behavior of the AVL tree. It is of type `Partial<AVLTreeOptions>`, which means that you can
34
32
  * provide only a subset of the properties defined in the `AVLTreeOptions` interface.
35
33
  */
36
- constructor(elements?: Iterable<BTNodeExemplar<K, V, N>>, options?: Partial<AVLTreeOptions<K>>);
34
+ constructor(elements?: Iterable<BTNExemplar<K, V, N>>, options?: Partial<AVLTreeOptions<K>>);
37
35
  /**
38
36
  * The function creates a new AVL tree node with the specified key and value.
39
37
  * @param {K} key - The key parameter is the key value that will be associated with
@@ -54,17 +52,17 @@ export declare class AVLTree<K = any, V = any, N extends AVLTreeNode<K, V, N> =
54
52
  createTree(options?: AVLTreeOptions<K>): TREE;
55
53
  /**
56
54
  * The function checks if an exemplar is an instance of AVLTreeNode.
57
- * @param exemplar - The `exemplar` parameter is of type `BTNodeExemplar<K, V, N>`.
55
+ * @param exemplar - The `exemplar` parameter is of type `BTNExemplar<K, V, N>`.
58
56
  * @returns a boolean value indicating whether the exemplar is an instance of the AVLTreeNode class.
59
57
  */
60
- isNode(exemplar: BTNodeExemplar<K, V, N>): exemplar is N;
58
+ isNode(exemplar: BTNExemplar<K, V, N>): exemplar is N;
61
59
  /**
62
60
  * The function "isNotNodeInstance" checks if a potential key is a K.
63
61
  * @param {any} potentialKey - The potentialKey parameter is of type any, which means it can be any
64
62
  * data type.
65
63
  * @returns a boolean value indicating whether the potentialKey is of type number or not.
66
64
  */
67
- isNotNodeInstance(potentialKey: BTNodeKeyOrNode<K, N>): potentialKey is K;
65
+ isNotNodeInstance(potentialKey: BTNKeyOrNode<K, N>): potentialKey is K;
68
66
  /**
69
67
  * Time Complexity: O(log n) - logarithmic time, where "n" is the number of nodes in the tree. The add method of the superclass (BST) has logarithmic time complexity.
70
68
  * Space Complexity: O(1) - constant space, as it doesn't use additional data structures that scale with input size.
@@ -81,7 +79,7 @@ export declare class AVLTree<K = any, V = any, N extends AVLTreeNode<K, V, N> =
81
79
  * being added to the binary tree.
82
80
  * @returns The method is returning either the inserted node or undefined.
83
81
  */
84
- add(keyOrNodeOrEntry: BTNodeExemplar<K, V, N>, value?: V): N | undefined;
82
+ add(keyOrNodeOrEntry: BTNExemplar<K, V, N>, value?: V): N | undefined;
85
83
  /**
86
84
  * Time Complexity: O(log n) - logarithmic time, where "n" is the number of nodes in the tree. The add method of the superclass (BST) has logarithmic time complexity.
87
85
  * Space Complexity: O(1) - constant space, as it doesn't use additional data structures that scale with input size.
@@ -99,9 +97,9 @@ export declare class AVLTree<K = any, V = any, N extends AVLTreeNode<K, V, N> =
99
97
  * that is deleted from the binary tree. It is an optional parameter and if not provided, it will
100
98
  * default to the `_defaultOneParamCallback` function. The `callback` function should have a single
101
99
  * parameter of type `N
102
- * @returns The method is returning an array of `BiTreeDeleteResult<N>`.
100
+ * @returns The method is returning an array of `BinaryTreeDeleteResult<N>`.
103
101
  */
104
- delete<C extends BTNCallback<N>>(identifier: ReturnType<C>, callback?: C): BiTreeDeleteResult<N>[];
102
+ delete<C extends BTNCallback<N>>(identifier: ReturnType<C>, callback?: C): BinaryTreeDeleteResult<N>[];
105
103
  /**
106
104
  * The `_swapProperties` function swaps the key, value, and height properties between two nodes in a binary
107
105
  * tree.
@@ -112,7 +110,7 @@ export declare class AVLTree<K = any, V = any, N extends AVLTreeNode<K, V, N> =
112
110
  * @returns either the `destNode` object if both `srcNode` and `destNode` are defined, or `undefined`
113
111
  * if either `srcNode` or `destNode` is undefined.
114
112
  */
115
- protected _swapProperties(srcNode: BSTNodeKeyOrNode<K, N>, destNode: BSTNodeKeyOrNode<K, N>): N | undefined;
113
+ protected _swapProperties(srcNode: BSTNKeyOrNode<K, N>, destNode: BSTNKeyOrNode<K, N>): N | undefined;
116
114
  /**
117
115
  * Time Complexity: O(1) - constant time, as it performs a fixed number of operations.
118
116
  * Space Complexity: O(1) - constant space, as it only uses a constant amount of memory.