data-structure-typed 1.32.2 → 1.32.9

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 (246) hide show
  1. package/.idea/data-structure-typed.iml +19 -0
  2. package/.idea/inspectionProfiles/Project_Default.xml +6 -0
  3. package/.idea/misc.xml +6 -0
  4. package/.idea/modules.xml +8 -0
  5. package/.idea/vcs.xml +6 -0
  6. package/CHANGELOG.md +1 -1
  7. package/README.md +366 -76
  8. package/coverage/coverage-final.json +4 -4
  9. package/docs/index.html +260 -9
  10. package/package.json +48 -16
  11. package/test/unit/data-structures/binary-tree/tree-multiset.test.ts +46 -1
  12. package/coverage/clover.xml +0 -3393
  13. package/coverage/lcov-report/base.css +0 -224
  14. package/coverage/lcov-report/block-navigation.js +0 -87
  15. package/coverage/lcov-report/favicon.png +0 -0
  16. package/coverage/lcov-report/index.html +0 -386
  17. package/coverage/lcov-report/prettify.css +0 -1
  18. package/coverage/lcov-report/prettify.js +0 -2
  19. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  20. package/coverage/lcov-report/sorter.js +0 -196
  21. package/coverage/lcov-report/src/data-structures/binary-tree/aa-tree.ts.html +0 -88
  22. package/coverage/lcov-report/src/data-structures/binary-tree/abstract-binary-tree.ts.html +0 -4978
  23. package/coverage/lcov-report/src/data-structures/binary-tree/avl-tree.ts.html +0 -1015
  24. package/coverage/lcov-report/src/data-structures/binary-tree/b-tree.ts.html +0 -88
  25. package/coverage/lcov-report/src/data-structures/binary-tree/binary-indexed-tree.ts.html +0 -313
  26. package/coverage/lcov-report/src/data-structures/binary-tree/binary-tree.ts.html +0 -226
  27. package/coverage/lcov-report/src/data-structures/binary-tree/bst.ts.html +0 -1696
  28. package/coverage/lcov-report/src/data-structures/binary-tree/index.html +0 -296
  29. package/coverage/lcov-report/src/data-structures/binary-tree/index.ts.html +0 -121
  30. package/coverage/lcov-report/src/data-structures/binary-tree/rb-tree.ts.html +0 -388
  31. package/coverage/lcov-report/src/data-structures/binary-tree/segment-tree.ts.html +0 -811
  32. package/coverage/lcov-report/src/data-structures/binary-tree/splay-tree.ts.html +0 -88
  33. package/coverage/lcov-report/src/data-structures/binary-tree/tree-multiset.ts.html +0 -2185
  34. package/coverage/lcov-report/src/data-structures/binary-tree/two-three-tree.ts.html +0 -88
  35. package/coverage/lcov-report/src/data-structures/graph/abstract-graph.ts.html +0 -3205
  36. package/coverage/lcov-report/src/data-structures/graph/directed-graph.ts.html +0 -1495
  37. package/coverage/lcov-report/src/data-structures/graph/index.html +0 -176
  38. package/coverage/lcov-report/src/data-structures/graph/index.ts.html +0 -97
  39. package/coverage/lcov-report/src/data-structures/graph/map-graph.ts.html +0 -472
  40. package/coverage/lcov-report/src/data-structures/graph/undirected-graph.ts.html +0 -907
  41. package/coverage/lcov-report/src/data-structures/hash/coordinate-map.ts.html +0 -286
  42. package/coverage/lcov-report/src/data-structures/hash/coordinate-set.ts.html +0 -253
  43. package/coverage/lcov-report/src/data-structures/hash/hash-table.ts.html +0 -88
  44. package/coverage/lcov-report/src/data-structures/hash/index.html +0 -206
  45. package/coverage/lcov-report/src/data-structures/hash/index.ts.html +0 -103
  46. package/coverage/lcov-report/src/data-structures/hash/pair.ts.html +0 -88
  47. package/coverage/lcov-report/src/data-structures/hash/tree-map.ts.html +0 -88
  48. package/coverage/lcov-report/src/data-structures/hash/tree-set.ts.html +0 -88
  49. package/coverage/lcov-report/src/data-structures/heap/heap.ts.html +0 -721
  50. package/coverage/lcov-report/src/data-structures/heap/index.html +0 -161
  51. package/coverage/lcov-report/src/data-structures/heap/index.ts.html +0 -94
  52. package/coverage/lcov-report/src/data-structures/heap/max-heap.ts.html +0 -178
  53. package/coverage/lcov-report/src/data-structures/heap/min-heap.ts.html +0 -181
  54. package/coverage/lcov-report/src/data-structures/index.html +0 -116
  55. package/coverage/lcov-report/src/data-structures/index.ts.html +0 -118
  56. package/coverage/lcov-report/src/data-structures/linked-list/doubly-linked-list.ts.html +0 -1804
  57. package/coverage/lcov-report/src/data-structures/linked-list/index.html +0 -161
  58. package/coverage/lcov-report/src/data-structures/linked-list/index.ts.html +0 -94
  59. package/coverage/lcov-report/src/data-structures/linked-list/singly-linked-list.ts.html +0 -1588
  60. package/coverage/lcov-report/src/data-structures/linked-list/skip-linked-list.ts.html +0 -88
  61. package/coverage/lcov-report/src/data-structures/matrix/index.html +0 -176
  62. package/coverage/lcov-report/src/data-structures/matrix/index.ts.html +0 -97
  63. package/coverage/lcov-report/src/data-structures/matrix/matrix.ts.html +0 -166
  64. package/coverage/lcov-report/src/data-structures/matrix/matrix2d.ts.html +0 -721
  65. package/coverage/lcov-report/src/data-structures/matrix/navigator.ts.html +0 -448
  66. package/coverage/lcov-report/src/data-structures/matrix/vector2d.ts.html +0 -1033
  67. package/coverage/lcov-report/src/data-structures/priority-queue/index.html +0 -161
  68. package/coverage/lcov-report/src/data-structures/priority-queue/index.ts.html +0 -94
  69. package/coverage/lcov-report/src/data-structures/priority-queue/max-priority-queue.ts.html +0 -253
  70. package/coverage/lcov-report/src/data-structures/priority-queue/min-priority-queue.ts.html +0 -256
  71. package/coverage/lcov-report/src/data-structures/priority-queue/priority-queue.ts.html +0 -1162
  72. package/coverage/lcov-report/src/data-structures/queue/deque.ts.html +0 -976
  73. package/coverage/lcov-report/src/data-structures/queue/index.html +0 -146
  74. package/coverage/lcov-report/src/data-structures/queue/index.ts.html +0 -91
  75. package/coverage/lcov-report/src/data-structures/queue/queue.ts.html +0 -658
  76. package/coverage/lcov-report/src/data-structures/stack/index.html +0 -131
  77. package/coverage/lcov-report/src/data-structures/stack/index.ts.html +0 -88
  78. package/coverage/lcov-report/src/data-structures/stack/stack.ts.html +0 -379
  79. package/coverage/lcov-report/src/data-structures/tree/index.html +0 -131
  80. package/coverage/lcov-report/src/data-structures/tree/index.ts.html +0 -88
  81. package/coverage/lcov-report/src/data-structures/tree/tree.ts.html +0 -292
  82. package/coverage/lcov-report/src/data-structures/trie/index.html +0 -131
  83. package/coverage/lcov-report/src/data-structures/trie/index.ts.html +0 -88
  84. package/coverage/lcov-report/src/data-structures/trie/trie.ts.html +0 -760
  85. package/coverage/lcov-report/src/index.html +0 -116
  86. package/coverage/lcov-report/src/index.ts.html +0 -97
  87. package/coverage/lcov-report/src/interfaces/index.html +0 -116
  88. package/coverage/lcov-report/src/interfaces/index.ts.html +0 -130
  89. package/coverage/lcov-report/src/types/data-structures/abstract-binary-tree.ts.html +0 -235
  90. package/coverage/lcov-report/src/types/data-structures/bst.ts.html +0 -124
  91. package/coverage/lcov-report/src/types/data-structures/directed-graph.ts.html +0 -109
  92. package/coverage/lcov-report/src/types/data-structures/index.html +0 -176
  93. package/coverage/lcov-report/src/types/data-structures/index.ts.html +0 -130
  94. package/coverage/lcov-report/src/types/data-structures/rb-tree.ts.html +0 -106
  95. package/coverage/lcov-report/src/types/index.html +0 -116
  96. package/coverage/lcov-report/src/types/index.ts.html +0 -94
  97. package/coverage/lcov-report/src/types/utils/index.html +0 -116
  98. package/coverage/lcov-report/src/types/utils/index.ts.html +0 -91
  99. package/coverage/lcov-report/src/utils/index.html +0 -131
  100. package/coverage/lcov-report/src/utils/index.ts.html +0 -88
  101. package/coverage/lcov-report/src/utils/utils.ts.html +0 -322
  102. package/coverage/lcov-report/test/utils/index.html +0 -146
  103. package/coverage/lcov-report/test/utils/index.ts.html +0 -91
  104. package/coverage/lcov-report/test/utils/magnitude.ts.html +0 -148
  105. package/coverage/lcov-report/test/utils/number.ts.html +0 -94
  106. package/coverage/lcov.info +0 -6676
  107. package/docs/assets/highlight.css +0 -127
  108. package/docs/assets/main.js +0 -58
  109. package/docs/assets/search.js +0 -1
  110. package/docs/assets/style.css +0 -1367
  111. package/docs/classes/AVLTree.html +0 -2182
  112. package/docs/classes/AVLTreeNode.html +0 -399
  113. package/docs/classes/AaTree.html +0 -202
  114. package/docs/classes/AbstractBinaryTree.html +0 -1836
  115. package/docs/classes/AbstractBinaryTreeNode.html +0 -441
  116. package/docs/classes/AbstractEdge.html +0 -345
  117. package/docs/classes/AbstractGraph.html +0 -1105
  118. package/docs/classes/AbstractVertex.html +0 -299
  119. package/docs/classes/ArrayDeque.html +0 -469
  120. package/docs/classes/BST.html +0 -2026
  121. package/docs/classes/BSTNode.html +0 -400
  122. package/docs/classes/BTree.html +0 -202
  123. package/docs/classes/BinaryIndexedTree.html +0 -371
  124. package/docs/classes/BinaryTree.html +0 -1867
  125. package/docs/classes/BinaryTreeNode.html +0 -399
  126. package/docs/classes/Character.html +0 -250
  127. package/docs/classes/CoordinateMap.html +0 -513
  128. package/docs/classes/CoordinateSet.html +0 -474
  129. package/docs/classes/Deque.html +0 -1005
  130. package/docs/classes/DirectedEdge.html +0 -404
  131. package/docs/classes/DirectedGraph.html +0 -1530
  132. package/docs/classes/DirectedVertex.html +0 -286
  133. package/docs/classes/DoublyLinkedList.html +0 -998
  134. package/docs/classes/DoublyLinkedListNode.html +0 -327
  135. package/docs/classes/HashTable.html +0 -202
  136. package/docs/classes/Heap.html +0 -647
  137. package/docs/classes/HeapItem.html +0 -296
  138. package/docs/classes/LinkedListQueue.html +0 -884
  139. package/docs/classes/MapEdge.html +0 -391
  140. package/docs/classes/MapGraph.html +0 -1583
  141. package/docs/classes/MapVertex.html +0 -356
  142. package/docs/classes/Matrix2D.html +0 -532
  143. package/docs/classes/MatrixNTI2D.html +0 -270
  144. package/docs/classes/MaxHeap.html +0 -671
  145. package/docs/classes/MaxPriorityQueue.html +0 -866
  146. package/docs/classes/MinHeap.html +0 -672
  147. package/docs/classes/MinPriorityQueue.html +0 -868
  148. package/docs/classes/Navigator.html +0 -343
  149. package/docs/classes/ObjectDeque.html +0 -527
  150. package/docs/classes/Pair.html +0 -202
  151. package/docs/classes/PriorityQueue.html +0 -790
  152. package/docs/classes/Queue.html +0 -521
  153. package/docs/classes/RBTree.html +0 -2024
  154. package/docs/classes/RBTreeNode.html +0 -431
  155. package/docs/classes/SegmentTree.html +0 -464
  156. package/docs/classes/SegmentTreeNode.html +0 -387
  157. package/docs/classes/SinglyLinkedList.html +0 -830
  158. package/docs/classes/SinglyLinkedListNode.html +0 -300
  159. package/docs/classes/SkipLinkedList.html +0 -202
  160. package/docs/classes/SplayTree.html +0 -202
  161. package/docs/classes/Stack.html +0 -398
  162. package/docs/classes/TreeMap.html +0 -202
  163. package/docs/classes/TreeMultiset.html +0 -2510
  164. package/docs/classes/TreeMultisetNode.html +0 -447
  165. package/docs/classes/TreeNode.html +0 -344
  166. package/docs/classes/TreeSet.html +0 -202
  167. package/docs/classes/Trie.html +0 -402
  168. package/docs/classes/TrieNode.html +0 -310
  169. package/docs/classes/TwoThreeTree.html +0 -202
  170. package/docs/classes/UndirectedEdge.html +0 -374
  171. package/docs/classes/UndirectedGraph.html +0 -1285
  172. package/docs/classes/UndirectedVertex.html +0 -284
  173. package/docs/classes/Vector2D.html +0 -835
  174. package/docs/enums/CP.html +0 -211
  175. package/docs/enums/FamilyPosition.html +0 -239
  176. package/docs/enums/LoopType.html +0 -212
  177. package/docs/enums/RBColor.html +0 -204
  178. package/docs/enums/TopologicalProperty.html +0 -211
  179. package/docs/functions/arrayRemove.html +0 -208
  180. package/docs/functions/isThunk.html +0 -186
  181. package/docs/functions/toThunk.html +0 -186
  182. package/docs/functions/trampoline.html +0 -186
  183. package/docs/functions/trampolineAsync.html +0 -186
  184. package/docs/functions/uuidV4.html +0 -181
  185. package/docs/interfaces/IAVLTree.html +0 -1245
  186. package/docs/interfaces/IAbstractBinaryTree.html +0 -1101
  187. package/docs/interfaces/IAbstractBinaryTreeNode.html +0 -335
  188. package/docs/interfaces/IAbstractGraph.html +0 -433
  189. package/docs/interfaces/IBST.html +0 -1245
  190. package/docs/interfaces/IDirectedGraph.html +0 -570
  191. package/docs/interfaces/IRBTree.html +0 -1247
  192. package/docs/interfaces/IUNDirectedGraph.html +0 -463
  193. package/docs/types/AVLTreeNodeNested.html +0 -182
  194. package/docs/types/AVLTreeOptions.html +0 -180
  195. package/docs/types/AbstractBinaryTreeNodeNested.html +0 -182
  196. package/docs/types/AbstractBinaryTreeNodeProperties.html +0 -182
  197. package/docs/types/AbstractBinaryTreeNodeProperty.html +0 -182
  198. package/docs/types/AbstractBinaryTreeOptions.html +0 -182
  199. package/docs/types/BSTComparator.html +0 -192
  200. package/docs/types/BSTNodeNested.html +0 -182
  201. package/docs/types/BSTOptions.html +0 -182
  202. package/docs/types/BinaryTreeDeletedResult.html +0 -189
  203. package/docs/types/BinaryTreeNodeId.html +0 -177
  204. package/docs/types/BinaryTreeNodeNested.html +0 -182
  205. package/docs/types/BinaryTreeNodePropertyName.html +0 -177
  206. package/docs/types/BinaryTreeOptions.html +0 -180
  207. package/docs/types/DFSOrderPattern.html +0 -177
  208. package/docs/types/DijkstraResult.html +0 -199
  209. package/docs/types/Direction.html +0 -177
  210. package/docs/types/DummyAny.html +0 -190
  211. package/docs/types/EdgeId.html +0 -177
  212. package/docs/types/HeapOptions.html +0 -198
  213. package/docs/types/IAVLTreeNode.html +0 -184
  214. package/docs/types/IBSTNode.html +0 -184
  215. package/docs/types/IBinaryTree.html +0 -182
  216. package/docs/types/IBinaryTreeNode.html +0 -184
  217. package/docs/types/IRBTreeNode.html +0 -184
  218. package/docs/types/ITreeMultiset.html +0 -182
  219. package/docs/types/ITreeMultisetNode.html +0 -184
  220. package/docs/types/KeyValueObject.html +0 -182
  221. package/docs/types/KeyValueObjectWithId.html +0 -184
  222. package/docs/types/MapGraphCoordinate.html +0 -177
  223. package/docs/types/NavigatorParams.html +0 -211
  224. package/docs/types/NodeOrPropertyName.html +0 -177
  225. package/docs/types/NonNumberNonObjectButDefined.html +0 -177
  226. package/docs/types/ObjectWithNonNumberId.html +0 -184
  227. package/docs/types/ObjectWithNumberId.html +0 -184
  228. package/docs/types/ObjectWithoutId.html +0 -177
  229. package/docs/types/PriorityQueueComparator.html +0 -197
  230. package/docs/types/PriorityQueueDFSOrderPattern.html +0 -177
  231. package/docs/types/PriorityQueueOptions.html +0 -191
  232. package/docs/types/RBTreeNodeNested.html +0 -182
  233. package/docs/types/RBTreeOptions.html +0 -180
  234. package/docs/types/RestrictValById.html +0 -177
  235. package/docs/types/SegmentTreeNodeVal.html +0 -177
  236. package/docs/types/SpecifyOptional.html +0 -184
  237. package/docs/types/Thunk.html +0 -185
  238. package/docs/types/ToThunkFn.html +0 -185
  239. package/docs/types/TopologicalStatus.html +0 -177
  240. package/docs/types/TreeMultisetNodeNested.html +0 -182
  241. package/docs/types/TreeMultisetOptions.html +0 -180
  242. package/docs/types/TrlAsyncFn.html +0 -190
  243. package/docs/types/TrlFn.html +0 -190
  244. package/docs/types/Turning.html +0 -177
  245. package/docs/types/VertexId.html +0 -177
  246. package/docs/variables/THUNK_SYMBOL.html +0 -177
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "data-structure-typed",
3
- "version": "1.32.2",
3
+ "version": "1.32.9",
4
4
  "description": "Data Structures of Javascript & TypeScript. Binary Tree, BST, Graph, Heap, Priority Queue, Linked List, Queue, Deque, Stack, AVL Tree, Tree Multiset, Trie, Directed Graph, Undirected Graph, Singly Linked List, Doubly Linked List, Max Heap, Max Priority Queue, Min Heap, Min Priority Queue.",
5
5
  "main": "dist/index.js",
6
6
  "module": "lib/index.js",
@@ -27,26 +27,21 @@
27
27
  "type": "git",
28
28
  "url": "git+https://github.com/zrwusa/data-structure-typed.git"
29
29
  },
30
- "targets": {
31
- "default": {
32
- "context": "node",
33
- "includeNodeModules": true,
34
- "engines": {
35
- "node": "19"
36
- }
37
- }
38
- },
39
- "engines": {
40
- "node": "19"
41
- },
42
30
  "keywords": [
43
31
  "data",
44
32
  "structure",
45
33
  "structures",
46
34
  "data structure",
35
+ "datastructure",
47
36
  "data-structure",
48
37
  "data structures",
38
+ "datastructures",
49
39
  "data-structures",
40
+ "in data structures",
41
+ "in data structure",
42
+ "DataStructure",
43
+ "DataStructures",
44
+
50
45
  "binary",
51
46
  "depth",
52
47
  "breadth",
@@ -74,49 +69,83 @@
74
69
  "ts",
75
70
  "javascript",
76
71
  "typscript",
72
+
73
+ "Node.js",
74
+ "CommonJS",
75
+ "ES6",
76
+ "UMD",
77
+ "esmodule",
78
+
79
+ "java.util",
80
+ "c++ std",
81
+ "Python collections",
82
+ "System.Collections.Generic",
83
+ "STD",
84
+ "std",
85
+ "util",
86
+ "Collections",
87
+ "collections",
88
+ "collection",
89
+ "util",
77
90
  "sort",
78
91
  "algorithm",
79
92
  "binary search tree",
93
+ "binarysearchtree",
80
94
  "binary-search-tree",
81
95
  "binary tree",
96
+ "binarytree",
82
97
  "binary-tree",
83
98
  "bst",
84
99
  "BST",
85
100
  "avl tree",
101
+ "avltree",
86
102
  "avl-tree",
87
103
  "tree multiset",
104
+ "treemultiset",
88
105
  "tree-multiset",
89
106
  "binary indexed tree",
107
+ "binaryindexedtree",
90
108
  "binary-indexed-tree",
91
109
  "segment tree",
110
+ "segmenttree",
92
111
  "segment-tree",
93
112
  "trie",
94
113
  "prefix tree",
114
+ "prefixtree",
95
115
  "prefix-tree",
96
116
  "dfs",
97
117
  "DFS",
98
118
  "depth first Search",
119
+ "depthfirstSearch",
99
120
  "depth-first-Search",
100
121
  "bfs",
101
122
  "BFS",
102
123
  "breadth first search",
124
+ "breadthfirstsearch",
103
125
  "dfs iterative",
104
126
  "DFS Iterative",
105
127
  "recursive",
106
128
  "iterative",
107
129
  "directed graph",
130
+ "directedgraph",
108
131
  "directed-graph",
109
132
  "undirected graph",
133
+ "undirectedgraph",
110
134
  "undirected-graph",
111
135
  "min heap",
136
+ "minheap",
112
137
  "min-heap",
113
138
  "max heap",
139
+ "maxheap",
114
140
  "max-heap",
115
141
  "priority queue",
142
+ "priorityqueue",
116
143
  "priority-queue",
117
144
  "max priority queue",
145
+ "maxpriorityqueue",
118
146
  "max-priority-queue",
119
147
  "min priority queue",
148
+ "minpriorityqueue",
120
149
  "min-priority-queue",
121
150
  "array queue",
122
151
  "array-queue",
@@ -126,10 +155,13 @@
126
155
  "object deque",
127
156
  "array deque",
128
157
  "linked list",
158
+ "linkedlist",
129
159
  "linked-list",
130
160
  "singly linked list",
161
+ "singlylinkedlist",
131
162
  "singly-linked-list",
132
163
  "doubly linked list",
164
+ "doublylinkedlist",
133
165
  "doubly-linked-list",
134
166
  "morris",
135
167
  "Morris",
@@ -143,9 +175,7 @@
143
175
  "floyd-warshall",
144
176
  "tarjan",
145
177
  "Tarjan",
146
- "Tarjan's",
147
- "DataStructure",
148
- "DataStructures"
178
+ "Tarjan's"
149
179
  ],
150
180
  "author": "Tyler Zeng zrwusa@gmail.com",
151
181
  "license": "MIT",
@@ -154,12 +184,14 @@
154
184
  },
155
185
  "homepage": "https://github.com/zrwusa/data-structure-typed#readme",
156
186
  "devDependencies": {
187
+ "@types/benchmark": "^2.1.3",
157
188
  "@types/jest": "^29.5.3",
158
189
  "@types/node": "^20.4.9",
159
190
  "@typescript-eslint/eslint-plugin": "^5.6.0",
160
191
  "@typescript-eslint/parser": "^5.11.0",
161
192
  "auto-changelog": "^2.4.0",
162
193
  "avl-tree-typed": "^1.31.0",
194
+ "benchmark": "^2.1.4",
163
195
  "binary-tree-typed": "^1.31.0",
164
196
  "bst-typed": "^1.31.0",
165
197
  "dependency-cruiser": "^13.1.2",
@@ -224,7 +224,7 @@ describe('TreeMultiset operations test', () => {
224
224
 
225
225
  expect(objTreeMultiset.has(6)).toBe(true);
226
226
 
227
- const node6 = objTreeMultiset.get(6);
227
+ // const node6 = objTreeMultiset.get(6);
228
228
  // expect(node6 && objTreeMultiset.getHeight(node6)).toBe(2);
229
229
  // expect(node6 && objTreeMultiset.getDepth(node6)).toBe(3);
230
230
  //
@@ -403,3 +403,48 @@ describe('TreeMultiset operations test', () => {
403
403
  // expect(objTreeMultiset.count).toBe(5);
404
404
  });
405
405
  });
406
+
407
+ describe('TreeMultiset Performance test', function () {
408
+ // const treeMS = new TreeMultiset<TreeMultisetNode<number>>();
409
+ // const inputSizes = [100]; // Adjust input sizes as needed
410
+ //
411
+ // // Define a function to calculate the expected O(n log n) time
412
+ // function expectedTime(n: number): number {
413
+ // return n * Math.log(n);
414
+ // }
415
+
416
+ it(`Observe the time consumption of TreeMultiset.add fitting O(n log n)`, function () {
417
+
418
+ // // Create a benchmark suite
419
+ // const suite = new Benchmark.Suite();
420
+ // // Define a function to generate a random array of a given size
421
+ // function generateRandomArray(size: number): number[] {
422
+ // const arr: number[] = [];
423
+ // for (let i = 0; i < size; i++) {
424
+ // arr.push(Math.floor(Math.random() * size));
425
+ // }
426
+ // return arr;
427
+ // }
428
+ // const inputArray = generateRandomArray(inputSizes[0]);
429
+ //
430
+ // suite.add(`TreeMultiset addMany (n=${inputSizes[0]})`, () => {
431
+ // treeMS.addMany([...inputArray]);
432
+ // });
433
+ //
434
+ // // Run the benchmarks
435
+ // suite
436
+ // .on('cycle', (event: any) => {
437
+ // const benchmark = event.target;
438
+ // const n = parseInt(benchmark.name.split('=')[1]);
439
+ // const observedTime = benchmark.times.elapsed;
440
+ // const expected = expectedTime(n);
441
+ // console.log(`Input size (n): ${n}, Observed time: ${observedTime.toFixed(2)}ms, Expected time: ${expected.toFixed(2)}ms`);
442
+ // })
443
+ // .on('complete', () => {
444
+ // console.log(`Benchmark (n=${inputSizes[0]}) completed.`);
445
+ // done(); // Call done to indicate the test is complete
446
+ // })
447
+ // .run({async: true});
448
+ });
449
+
450
+ });