data-structure-typed 1.49.5 → 1.49.7

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 (222) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/README.md +17 -23
  3. package/README_zh-CN.md +2 -0
  4. package/benchmark/report.html +14 -23
  5. package/benchmark/report.json +158 -251
  6. package/dist/cjs/data-structures/binary-tree/avl-tree.d.ts +53 -48
  7. package/dist/cjs/data-structures/binary-tree/avl-tree.js +55 -49
  8. package/dist/cjs/data-structures/binary-tree/avl-tree.js.map +1 -1
  9. package/dist/cjs/data-structures/binary-tree/binary-tree.d.ts +153 -130
  10. package/dist/cjs/data-structures/binary-tree/binary-tree.js +194 -153
  11. package/dist/cjs/data-structures/binary-tree/binary-tree.js.map +1 -1
  12. package/dist/cjs/data-structures/binary-tree/bst.d.ts +83 -71
  13. package/dist/cjs/data-structures/binary-tree/bst.js +114 -91
  14. package/dist/cjs/data-structures/binary-tree/bst.js.map +1 -1
  15. package/dist/cjs/data-structures/binary-tree/rb-tree.d.ts +37 -35
  16. package/dist/cjs/data-structures/binary-tree/rb-tree.js +62 -59
  17. package/dist/cjs/data-structures/binary-tree/rb-tree.js.map +1 -1
  18. package/dist/cjs/data-structures/binary-tree/tree-multimap.d.ts +46 -39
  19. package/dist/cjs/data-structures/binary-tree/tree-multimap.js +58 -51
  20. package/dist/cjs/data-structures/binary-tree/tree-multimap.js.map +1 -1
  21. package/dist/cjs/data-structures/hash/hash-map.d.ts +24 -27
  22. package/dist/cjs/data-structures/hash/hash-map.js +35 -35
  23. package/dist/cjs/data-structures/hash/hash-map.js.map +1 -1
  24. package/dist/cjs/data-structures/hash/index.d.ts +0 -1
  25. package/dist/cjs/data-structures/hash/index.js +0 -1
  26. package/dist/cjs/data-structures/hash/index.js.map +1 -1
  27. package/dist/cjs/data-structures/heap/heap.d.ts +2 -1
  28. package/dist/cjs/data-structures/heap/heap.js +13 -13
  29. package/dist/cjs/data-structures/heap/heap.js.map +1 -1
  30. package/dist/cjs/data-structures/heap/max-heap.js +1 -1
  31. package/dist/cjs/data-structures/heap/max-heap.js.map +1 -1
  32. package/dist/cjs/data-structures/heap/min-heap.js +1 -1
  33. package/dist/cjs/data-structures/heap/min-heap.js.map +1 -1
  34. package/dist/cjs/data-structures/linked-list/doubly-linked-list.js +1 -1
  35. package/dist/cjs/data-structures/linked-list/doubly-linked-list.js.map +1 -1
  36. package/dist/cjs/data-structures/linked-list/singly-linked-list.js +1 -3
  37. package/dist/cjs/data-structures/linked-list/singly-linked-list.js.map +1 -1
  38. package/dist/cjs/data-structures/linked-list/skip-linked-list.d.ts +2 -8
  39. package/dist/cjs/data-structures/linked-list/skip-linked-list.js +15 -18
  40. package/dist/cjs/data-structures/linked-list/skip-linked-list.js.map +1 -1
  41. package/dist/cjs/data-structures/matrix/matrix.d.ts +2 -7
  42. package/dist/cjs/data-structures/matrix/matrix.js +0 -7
  43. package/dist/cjs/data-structures/matrix/matrix.js.map +1 -1
  44. package/dist/cjs/data-structures/priority-queue/max-priority-queue.js +1 -1
  45. package/dist/cjs/data-structures/priority-queue/max-priority-queue.js.map +1 -1
  46. package/dist/cjs/data-structures/priority-queue/min-priority-queue.js +1 -1
  47. package/dist/cjs/data-structures/priority-queue/min-priority-queue.js.map +1 -1
  48. package/dist/cjs/data-structures/priority-queue/priority-queue.js +1 -1
  49. package/dist/cjs/data-structures/priority-queue/priority-queue.js.map +1 -1
  50. package/dist/cjs/data-structures/queue/deque.d.ts +2 -11
  51. package/dist/cjs/data-structures/queue/deque.js +9 -13
  52. package/dist/cjs/data-structures/queue/deque.js.map +1 -1
  53. package/dist/cjs/data-structures/queue/queue.d.ts +13 -13
  54. package/dist/cjs/data-structures/queue/queue.js +29 -25
  55. package/dist/cjs/data-structures/queue/queue.js.map +1 -1
  56. package/dist/cjs/data-structures/stack/stack.js +2 -3
  57. package/dist/cjs/data-structures/stack/stack.js.map +1 -1
  58. package/dist/cjs/data-structures/trie/trie.d.ts +2 -2
  59. package/dist/cjs/data-structures/trie/trie.js +9 -5
  60. package/dist/cjs/data-structures/trie/trie.js.map +1 -1
  61. package/dist/cjs/interfaces/binary-tree.d.ts +3 -3
  62. package/dist/cjs/types/common.d.ts +3 -3
  63. package/dist/cjs/types/common.js +2 -2
  64. package/dist/cjs/types/common.js.map +1 -1
  65. package/dist/cjs/types/data-structures/binary-tree/binary-tree.d.ts +2 -2
  66. package/dist/cjs/types/data-structures/binary-tree/bst.d.ts +1 -1
  67. package/dist/cjs/types/data-structures/binary-tree/tree-multimap.d.ts +1 -1
  68. package/dist/cjs/types/data-structures/hash/hash-map.d.ts +5 -2
  69. package/dist/cjs/types/data-structures/hash/index.d.ts +0 -1
  70. package/dist/cjs/types/data-structures/hash/index.js +0 -1
  71. package/dist/cjs/types/data-structures/hash/index.js.map +1 -1
  72. package/dist/cjs/types/data-structures/heap/heap.d.ts +1 -1
  73. package/dist/cjs/types/data-structures/linked-list/index.d.ts +1 -0
  74. package/dist/cjs/types/data-structures/linked-list/index.js +1 -0
  75. package/dist/cjs/types/data-structures/linked-list/index.js.map +1 -1
  76. package/dist/cjs/types/data-structures/linked-list/skip-linked-list.d.ts +4 -1
  77. package/dist/cjs/types/data-structures/matrix/index.d.ts +1 -0
  78. package/dist/cjs/types/data-structures/matrix/index.js +1 -0
  79. package/dist/cjs/types/data-structures/matrix/index.js.map +1 -1
  80. package/dist/cjs/types/data-structures/matrix/matrix.d.ts +7 -1
  81. package/dist/cjs/types/data-structures/queue/deque.d.ts +3 -1
  82. package/dist/cjs/types/data-structures/trie/trie.d.ts +3 -1
  83. package/dist/mjs/data-structures/binary-tree/avl-tree.d.ts +53 -48
  84. package/dist/mjs/data-structures/binary-tree/avl-tree.js +55 -49
  85. package/dist/mjs/data-structures/binary-tree/binary-tree.d.ts +153 -130
  86. package/dist/mjs/data-structures/binary-tree/binary-tree.js +194 -153
  87. package/dist/mjs/data-structures/binary-tree/bst.d.ts +83 -71
  88. package/dist/mjs/data-structures/binary-tree/bst.js +114 -91
  89. package/dist/mjs/data-structures/binary-tree/rb-tree.d.ts +37 -35
  90. package/dist/mjs/data-structures/binary-tree/rb-tree.js +62 -59
  91. package/dist/mjs/data-structures/binary-tree/tree-multimap.d.ts +46 -39
  92. package/dist/mjs/data-structures/binary-tree/tree-multimap.js +58 -51
  93. package/dist/mjs/data-structures/hash/hash-map.d.ts +24 -27
  94. package/dist/mjs/data-structures/hash/hash-map.js +35 -37
  95. package/dist/mjs/data-structures/hash/index.d.ts +0 -1
  96. package/dist/mjs/data-structures/hash/index.js +0 -1
  97. package/dist/mjs/data-structures/heap/heap.d.ts +2 -1
  98. package/dist/mjs/data-structures/heap/heap.js +19 -20
  99. package/dist/mjs/data-structures/heap/max-heap.js +1 -1
  100. package/dist/mjs/data-structures/heap/min-heap.js +1 -1
  101. package/dist/mjs/data-structures/linked-list/doubly-linked-list.js +1 -1
  102. package/dist/mjs/data-structures/linked-list/singly-linked-list.js +2 -5
  103. package/dist/mjs/data-structures/linked-list/skip-linked-list.d.ts +2 -8
  104. package/dist/mjs/data-structures/linked-list/skip-linked-list.js +16 -23
  105. package/dist/mjs/data-structures/matrix/matrix.d.ts +2 -7
  106. package/dist/mjs/data-structures/matrix/matrix.js +0 -7
  107. package/dist/mjs/data-structures/priority-queue/max-priority-queue.js +1 -1
  108. package/dist/mjs/data-structures/priority-queue/min-priority-queue.js +1 -1
  109. package/dist/mjs/data-structures/priority-queue/priority-queue.js +1 -1
  110. package/dist/mjs/data-structures/queue/deque.d.ts +2 -11
  111. package/dist/mjs/data-structures/queue/deque.js +9 -14
  112. package/dist/mjs/data-structures/queue/queue.d.ts +13 -13
  113. package/dist/mjs/data-structures/queue/queue.js +30 -28
  114. package/dist/mjs/data-structures/stack/stack.js +3 -5
  115. package/dist/mjs/data-structures/trie/trie.d.ts +2 -2
  116. package/dist/mjs/data-structures/trie/trie.js +10 -9
  117. package/dist/mjs/interfaces/binary-tree.d.ts +3 -3
  118. package/dist/mjs/types/common.d.ts +3 -3
  119. package/dist/mjs/types/common.js +2 -2
  120. package/dist/mjs/types/data-structures/binary-tree/binary-tree.d.ts +2 -2
  121. package/dist/mjs/types/data-structures/binary-tree/bst.d.ts +1 -1
  122. package/dist/mjs/types/data-structures/binary-tree/tree-multimap.d.ts +1 -1
  123. package/dist/mjs/types/data-structures/hash/hash-map.d.ts +5 -2
  124. package/dist/mjs/types/data-structures/hash/index.d.ts +0 -1
  125. package/dist/mjs/types/data-structures/hash/index.js +0 -1
  126. package/dist/mjs/types/data-structures/heap/heap.d.ts +1 -1
  127. package/dist/mjs/types/data-structures/linked-list/index.d.ts +1 -0
  128. package/dist/mjs/types/data-structures/linked-list/index.js +1 -0
  129. package/dist/mjs/types/data-structures/linked-list/skip-linked-list.d.ts +4 -1
  130. package/dist/mjs/types/data-structures/matrix/index.d.ts +1 -0
  131. package/dist/mjs/types/data-structures/matrix/index.js +1 -0
  132. package/dist/mjs/types/data-structures/matrix/matrix.d.ts +7 -1
  133. package/dist/mjs/types/data-structures/queue/deque.d.ts +3 -1
  134. package/dist/mjs/types/data-structures/trie/trie.d.ts +3 -1
  135. package/dist/umd/data-structure-typed.js +620 -823
  136. package/dist/umd/data-structure-typed.min.js +2 -2
  137. package/dist/umd/data-structure-typed.min.js.map +1 -1
  138. package/package.json +1 -1
  139. package/src/data-structures/binary-tree/avl-tree.ts +58 -53
  140. package/src/data-structures/binary-tree/binary-tree.ts +255 -211
  141. package/src/data-structures/binary-tree/bst.ts +126 -107
  142. package/src/data-structures/binary-tree/rb-tree.ts +66 -64
  143. package/src/data-structures/binary-tree/tree-multimap.ts +62 -56
  144. package/src/data-structures/hash/hash-map.ts +46 -50
  145. package/src/data-structures/hash/index.ts +0 -1
  146. package/src/data-structures/heap/heap.ts +20 -19
  147. package/src/data-structures/heap/max-heap.ts +1 -1
  148. package/src/data-structures/heap/min-heap.ts +1 -1
  149. package/src/data-structures/linked-list/doubly-linked-list.ts +1 -1
  150. package/src/data-structures/linked-list/singly-linked-list.ts +2 -5
  151. package/src/data-structures/linked-list/skip-linked-list.ts +15 -16
  152. package/src/data-structures/matrix/matrix.ts +2 -10
  153. package/src/data-structures/priority-queue/max-priority-queue.ts +1 -1
  154. package/src/data-structures/priority-queue/min-priority-queue.ts +1 -1
  155. package/src/data-structures/priority-queue/priority-queue.ts +1 -1
  156. package/src/data-structures/queue/deque.ts +11 -15
  157. package/src/data-structures/queue/queue.ts +29 -28
  158. package/src/data-structures/stack/stack.ts +3 -6
  159. package/src/data-structures/trie/trie.ts +10 -11
  160. package/src/interfaces/binary-tree.ts +3 -3
  161. package/src/types/common.ts +3 -3
  162. package/src/types/data-structures/binary-tree/binary-tree.ts +2 -2
  163. package/src/types/data-structures/binary-tree/bst.ts +1 -1
  164. package/src/types/data-structures/binary-tree/tree-multimap.ts +1 -1
  165. package/src/types/data-structures/hash/hash-map.ts +6 -2
  166. package/src/types/data-structures/hash/index.ts +0 -1
  167. package/src/types/data-structures/heap/heap.ts +1 -1
  168. package/src/types/data-structures/linked-list/index.ts +1 -0
  169. package/src/types/data-structures/linked-list/skip-linked-list.ts +1 -1
  170. package/src/types/data-structures/matrix/index.ts +1 -0
  171. package/src/types/data-structures/matrix/matrix.ts +7 -1
  172. package/src/types/data-structures/queue/deque.ts +1 -1
  173. package/src/types/data-structures/trie/trie.ts +1 -1
  174. package/test/performance/data-structures/binary-tree/avl-tree.test.ts +4 -12
  175. package/test/performance/data-structures/binary-tree/binary-tree-overall.test.ts +37 -0
  176. package/test/performance/data-structures/binary-tree/binary-tree.test.ts +6 -16
  177. package/test/performance/data-structures/binary-tree/bst.test.ts +5 -13
  178. package/test/performance/data-structures/binary-tree/rb-tree.test.ts +5 -15
  179. package/test/performance/data-structures/comparison/comparison.test.ts +13 -36
  180. package/test/performance/data-structures/graph/directed-graph.test.ts +3 -14
  181. package/test/performance/data-structures/hash/hash-map.test.ts +11 -34
  182. package/test/performance/data-structures/heap/heap.test.ts +5 -18
  183. package/test/performance/data-structures/linked-list/doubly-linked-list.test.ts +0 -1
  184. package/test/performance/data-structures/linked-list/singly-linked-list.test.ts +0 -2
  185. package/test/performance/data-structures/priority-queue/max-priority-queue.test.ts +2 -4
  186. package/test/performance/data-structures/priority-queue/priority-queue.test.ts +4 -14
  187. package/test/performance/data-structures/queue/queue.test.ts +8 -25
  188. package/test/performance/data-structures/stack/stack.test.ts +6 -18
  189. package/test/performance/data-structures/trie/trie.test.ts +2 -6
  190. package/test/unit/data-structures/binary-tree/binary-tree.test.ts +6 -5
  191. package/test/unit/data-structures/binary-tree/bst.test.ts +17 -1
  192. package/test/unit/data-structures/linked-list/skip-list.test.ts +1 -1
  193. package/test/unit/data-structures/queue/deque.test.ts +5 -5
  194. package/test/unit/data-structures/trie/trie.test.ts +1 -1
  195. package/dist/cjs/data-structures/hash/hash-table.d.ts +0 -108
  196. package/dist/cjs/data-structures/hash/hash-table.js +0 -282
  197. package/dist/cjs/data-structures/hash/hash-table.js.map +0 -1
  198. package/dist/cjs/types/data-structures/hash/hash-table.d.ts +0 -1
  199. package/dist/cjs/types/data-structures/hash/hash-table.js +0 -3
  200. package/dist/cjs/types/data-structures/hash/hash-table.js.map +0 -1
  201. package/dist/cjs/types/data-structures/matrix/matrix2d.d.ts +0 -1
  202. package/dist/cjs/types/data-structures/matrix/matrix2d.js +0 -3
  203. package/dist/cjs/types/data-structures/matrix/matrix2d.js.map +0 -1
  204. package/dist/cjs/types/data-structures/matrix/vector2d.d.ts +0 -1
  205. package/dist/cjs/types/data-structures/matrix/vector2d.js +0 -3
  206. package/dist/cjs/types/data-structures/matrix/vector2d.js.map +0 -1
  207. package/dist/mjs/data-structures/hash/hash-table.d.ts +0 -108
  208. package/dist/mjs/data-structures/hash/hash-table.js +0 -283
  209. package/dist/mjs/types/data-structures/hash/hash-table.d.ts +0 -1
  210. package/dist/mjs/types/data-structures/hash/hash-table.js +0 -1
  211. package/dist/mjs/types/data-structures/matrix/matrix2d.d.ts +0 -1
  212. package/dist/mjs/types/data-structures/matrix/matrix2d.js +0 -1
  213. package/dist/mjs/types/data-structures/matrix/vector2d.d.ts +0 -1
  214. package/dist/mjs/types/data-structures/matrix/vector2d.js +0 -1
  215. package/src/data-structures/hash/hash-table.ts +0 -318
  216. package/src/types/data-structures/hash/hash-table.ts +0 -1
  217. package/src/types/data-structures/matrix/matrix2d.ts +0 -1
  218. package/src/types/data-structures/matrix/vector2d.ts +0 -1
  219. package/test/performance/data-structures/binary-tree/overall.test.ts +0 -0
  220. package/test/performance/data-structures/matrix/matrix2d.test.ts +0 -0
  221. package/test/performance/data-structures/matrix/vector2d.test.ts +0 -0
  222. package/test/unit/data-structures/hash/hash-table.test.ts +0 -238
@@ -9,14 +9,10 @@ const randomWords = getRandomWords(HUNDRED_THOUSAND, false);
9
9
 
10
10
  suite
11
11
  .add(`${HUNDRED_THOUSAND.toLocaleString()} push`, () => {
12
- for (let i = 0; i < randomWords.length; i++) {
13
- trie.add(randomWords[i]);
14
- }
12
+ for (let i = 0; i < randomWords.length; i++) trie.add(randomWords[i]);
15
13
  })
16
14
  .add(`${HUNDRED_THOUSAND.toLocaleString()} getWords`, () => {
17
- for (let i = 0; i < randomWords.length; i++) {
18
- trie.getWords(randomWords[i]);
19
- }
15
+ for (let i = 0; i < randomWords.length; i++) trie.getWords(randomWords[i]);
20
16
  });
21
17
 
22
18
  export { suite };
@@ -106,7 +106,8 @@ describe('BinaryTree', () => {
106
106
  it('should delete nodes', () => {
107
107
  expect(tree.getHeight(tree.root, IterationType.ITERATIVE)).toBe(-1);
108
108
  expect(tree.getMinHeight()).toBe(-1);
109
- const node1 = tree.add(1);
109
+ const node1 = tree.createNode(1);
110
+ tree.add(node1);
110
111
  expect(tree.size).toBe(1);
111
112
 
112
113
  const leftChild = new BinaryTreeNode<number>(2);
@@ -224,15 +225,15 @@ describe('BinaryTree', () => {
224
225
  new BinaryTreeNode(4, 4)
225
226
  ]);
226
227
 
227
- expect(tree.isSubtreeBST(tree.getNode(4), IterationType.RECURSIVE)).toBe(true);
228
- expect(tree.isSubtreeBST(tree.getNode(4), IterationType.ITERATIVE)).toBe(true);
228
+ expect(tree.isBST(tree.getNode(4), IterationType.RECURSIVE)).toBe(true);
229
+ expect(tree.isBST(tree.getNode(4), IterationType.ITERATIVE)).toBe(true);
229
230
  });
230
231
 
231
232
  it('should isSubtreeBST', () => {
232
233
  tree.addMany([4, 2, 6, 1, 3, 5, 7, 4]);
233
234
 
234
- expect(tree.isSubtreeBST(tree.getNode(4), IterationType.RECURSIVE)).toBe(true);
235
- expect(tree.isSubtreeBST(tree.getNode(4), IterationType.ITERATIVE)).toBe(true);
235
+ expect(tree.isBST(tree.getNode(4), IterationType.RECURSIVE)).toBe(true);
236
+ expect(tree.isBST(tree.getNode(4), IterationType.ITERATIVE)).toBe(true);
236
237
  expect(tree.getNodes(2, undefined, false, null)).toEqual([]);
237
238
  expect(tree.getNodes(tree.getNodeByKey(2), undefined, false, tree.root)).toEqual([tree.getNodeByKey(2)]);
238
239
  });
@@ -1,4 +1,4 @@
1
- import { BinaryTreeNode, BST, BSTNode, CP, IterationType } from '../../../../src';
1
+ import { BinaryTreeNode, BST, BSTNode, BSTVariant, CP, IterationType } from '../../../../src';
2
2
  import { isDebugTest } from '../../../config';
3
3
 
4
4
  const isDebug = isDebugTest;
@@ -47,6 +47,8 @@ describe('BST operations test', () => {
47
47
  const leftMost = bst.getLeftMost();
48
48
  expect(leftMost?.key).toBe(1);
49
49
 
50
+ expect(bst.isBST()).toBe(true);
51
+
50
52
  const node15 = bst.getNode(15);
51
53
  const minNodeBySpecificNode = node15 && bst.getLeftMost(node15);
52
54
  expect(minNodeBySpecificNode?.key).toBe(12);
@@ -795,6 +797,20 @@ describe('BST operations test recursively', () => {
795
797
  });
796
798
  });
797
799
 
800
+ describe('BST isBST', function () {
801
+ test('isBST', () => {
802
+ const bst = new BST<number, number>();
803
+ bst.addMany([1, 2, 3, 9, 8, 5, 6, 7, 4]);
804
+ expect(bst.isBST()).toBe(true);
805
+ });
806
+
807
+ test('isBST when variant is Max', () => {
808
+ const bst = new BST<number, number>([1, 2, 3, 9, 8, 5, 6, 7, 4], { variant: BSTVariant.INVERSE });
809
+ bst.addMany([1, 2, 3, 9, 8, 5, 6, 7, 4]);
810
+ expect(bst.isBST()).toBe(true);
811
+ });
812
+ });
813
+
798
814
  describe('BST Performance test', function () {
799
815
  const bst = new BST<number, number>();
800
816
  const inputSize = 10000; // Adjust input sizes as needed
@@ -32,7 +32,7 @@ describe('SkipList', () => {
32
32
 
33
33
  skipList.delete(2);
34
34
 
35
- expect(skipList.get(2)).toBeUndefined(); // 修改这里的断言
35
+ expect(skipList.get(2)).toBeUndefined();
36
36
  });
37
37
 
38
38
  it('should handle random data correctly', () => {
@@ -231,10 +231,10 @@ describe('Deque - Additional Operations', () => {
231
231
  });
232
232
  describe('Deque - push Method', () => {
233
233
  let deque: Deque<number>;
234
- const bucketSize = 10; // 假设的 bucket 大小
234
+ const bucketSize = 10;
235
235
 
236
236
  beforeEach(() => {
237
- deque = new Deque<number>([], bucketSize);
237
+ deque = new Deque<number>([], { bucketSize });
238
238
  });
239
239
 
240
240
  test('push should add an element when deque is empty', () => {
@@ -276,7 +276,7 @@ describe('Deque - pop Method', () => {
276
276
  const bucketSize = 10;
277
277
 
278
278
  beforeEach(() => {
279
- deque = new Deque<number>([], bucketSize);
279
+ deque = new Deque<number>([], { bucketSize });
280
280
  });
281
281
 
282
282
  test('pop should remove and return the last element', () => {
@@ -307,7 +307,7 @@ describe('Deque - unshift Method', () => {
307
307
  const bucketSize = 10;
308
308
 
309
309
  beforeEach(() => {
310
- deque = new Deque<number>([], bucketSize);
310
+ deque = new Deque<number>([], { bucketSize });
311
311
  });
312
312
 
313
313
  test('unshift should add an element to the beginning when deque is empty', () => {
@@ -339,7 +339,7 @@ describe('Deque - shift Method', () => {
339
339
  const bucketSize = 10;
340
340
 
341
341
  beforeEach(() => {
342
- deque = new Deque<number>([], bucketSize);
342
+ deque = new Deque<number>([], { bucketSize });
343
343
  });
344
344
 
345
345
  test('shift should remove and return the first element', () => {
@@ -778,7 +778,7 @@ describe('Trie operations', () => {
778
778
  });
779
779
 
780
780
  it('Case Sensitivity', () => {
781
- const caseInsensitiveTrie = new Trie(['apple', 'Banana'], false);
781
+ const caseInsensitiveTrie = new Trie(['apple', 'Banana'], { caseSensitive: false });
782
782
  expect(caseInsensitiveTrie.has('APPLE')).toBe(true);
783
783
  expect(caseInsensitiveTrie.has('banana')).toBe(true);
784
784
  expect(caseInsensitiveTrie.has('Cherry')).toBe(false);
@@ -1,108 +0,0 @@
1
- /**
2
- * data-structure-typed
3
- *
4
- * @author Tyler Zeng
5
- * @copyright Copyright (c) 2022 Tyler Zeng <zrwusa@gmail.com>
6
- * @license MIT License
7
- */
8
- import type { HashFunction } from '../../types';
9
- export declare class HashTableNode<K = any, V = any> {
10
- key: K;
11
- value: V;
12
- next: HashTableNode<K, V> | undefined;
13
- constructor(key: K, value: V);
14
- }
15
- export declare class HashTable<K = any, V = any> {
16
- protected static readonly DEFAULT_CAPACITY = 16;
17
- protected static readonly LOAD_FACTOR = 0.75;
18
- constructor(capacity?: number, hashFn?: HashFunction<K>);
19
- protected _capacity: number;
20
- get capacity(): number;
21
- protected _size: number;
22
- get size(): number;
23
- protected _buckets: Array<HashTableNode<K, V> | undefined>;
24
- get buckets(): Array<HashTableNode<K, V> | undefined>;
25
- protected _hashFn: HashFunction<K>;
26
- get hashFn(): HashFunction<K>;
27
- /**
28
- * The set function adds a key-value pair to the hash table, handling collisions and resizing if necessary.
29
- * @param {K} key - The key parameter represents the key of the key-value pair that you want to insert into the hash
30
- * table. It is of type K, which is a generic type representing the key's data type.
31
- * @param {V} value - The parameter `value` represents the value that you want to associate with the given key in the hash
32
- * table.
33
- * @returns Nothing is being returned. The return type of the `put` method is `void`, which means it does not return any
34
- * value.
35
- */
36
- set(key: K, value: V): void;
37
- /**
38
- * The `get` function retrieves the value associated with a given key from a hash table.
39
- * @param {K} key - The `key` parameter represents the key of the element that we want to retrieve from the data
40
- * structure.
41
- * @returns The method is returning the value associated with the given key if it exists in the hash table. If the key is
42
- * not found, it returns `undefined`.
43
- */
44
- get(key: K): V | undefined;
45
- /**
46
- * The delete function removes a key-value pair from a hash table.
47
- * @param {K} key - The `key` parameter represents the key of the key-value pair that needs to be removed from the hash
48
- * table.
49
- * @returns Nothing is being returned. The `delete` method has a return type of `void`, which means it does not return
50
- * any value.
51
- */
52
- delete(key: K): void;
53
- [Symbol.iterator](): Generator<[K, V], void, undefined>;
54
- forEach(callback: (entry: [K, V], index: number, table: HashTable<K, V>) => void): void;
55
- filter(predicate: (entry: [K, V], index: number, table: HashTable<K, V>) => boolean): HashTable<K, V>;
56
- map<T>(callback: (entry: [K, V], index: number, table: HashTable<K, V>) => T): HashTable<K, T>;
57
- reduce<T>(callback: (accumulator: T, entry: [K, V], index: number, table: HashTable<K, V>) => T, initialValue: T): T;
58
- /**
59
- * The function `_defaultHashFn` calculates the hash value of a given key and returns the remainder when divided by the
60
- * capacity of the data structure.
61
- * @param {K} key - The `key` parameter is the input value that needs to be hashed. It can be of any type, but in this
62
- * code snippet, it is checked whether the key is a string or an object. If it is a string, the `_murmurStringHashFn`
63
- * function is used to
64
- * @returns the hash value of the key modulo the capacity of the data structure.
65
- */
66
- protected _defaultHashFn(key: K): number;
67
- /**
68
- * The `_multiplicativeStringHashFn` function calculates a hash value for a given string key using the multiplicative
69
- * string hash function.
70
- * @param {K} key - The `key` parameter is the input value for which we want to calculate the hash. It can be of any
71
- * type, as it is generic (`K`). The function converts the `key` to a string using the `String()` function.
72
- * @returns a number, which is the result of the multiplicative string hash function applied to the input key.
73
- */
74
- protected _multiplicativeStringHashFn<K>(key: K): number;
75
- /**
76
- * The function `_murmurStringHashFn` calculates a hash value for a given string key using the MurmurHash algorithm.
77
- * @param {K} key - The `key` parameter is the input value for which you want to calculate the hash. It can be of any
78
- * type, but it will be converted to a string using the `String()` function before calculating the hash.
79
- * @returns a number, which is the hash value calculated for the given key.
80
- */
81
- protected _murmurStringHashFn<K>(key: K): number;
82
- /**
83
- * The _hash function takes a key and returns a number.
84
- * @param {K} key - The parameter "key" is of type K, which represents the type of the key that will be hashed.
85
- * @returns The hash function is returning a number.
86
- */
87
- protected _hash(key: K): number;
88
- /**
89
- * The function calculates a hash value for a given string using the djb2 algorithm.
90
- * @param {string} key - The `key` parameter in the `stringHash` function is a string value that represents the input for
91
- * which we want to calculate the hash value.
92
- * @returns a number, which is the hash value of the input string.
93
- */
94
- protected _stringHash(key: string): number;
95
- /**
96
- * The function `_objectHash` takes a key and returns a hash value, using a custom hash function for objects.
97
- * @param {K} key - The parameter "key" is of type "K", which means it can be any type. It could be a string, number,
98
- * boolean, object, or any other type of value. The purpose of the objectHash function is to generate a hash value for
99
- * the key, which can be used for
100
- * @returns a number, which is the hash value of the key.
101
- */
102
- protected _objectHash(key: K): number;
103
- /**
104
- * The `expand` function increases the capacity of a hash table by creating a new array of buckets with double the
105
- * capacity and rehashing all the existing key-value pairs into the new buckets.
106
- */
107
- protected _expand(): void;
108
- }
@@ -1,282 +0,0 @@
1
- "use strict";
2
- /**
3
- * data-structure-typed
4
- *
5
- * @author Tyler Zeng
6
- * @copyright Copyright (c) 2022 Tyler Zeng <zrwusa@gmail.com>
7
- * @license MIT License
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.HashTable = exports.HashTableNode = void 0;
11
- class HashTableNode {
12
- constructor(key, value) {
13
- this.key = key;
14
- this.value = value;
15
- this.next = undefined;
16
- }
17
- }
18
- exports.HashTableNode = HashTableNode;
19
- class HashTable {
20
- constructor(capacity = HashTable.DEFAULT_CAPACITY, hashFn) {
21
- this._hashFn = hashFn || this._defaultHashFn;
22
- this._capacity = Math.max(capacity, HashTable.DEFAULT_CAPACITY);
23
- this._size = 0;
24
- this._buckets = new Array(this._capacity).fill(undefined);
25
- }
26
- get capacity() {
27
- return this._capacity;
28
- }
29
- get size() {
30
- return this._size;
31
- }
32
- get buckets() {
33
- return this._buckets;
34
- }
35
- get hashFn() {
36
- return this._hashFn;
37
- }
38
- /**
39
- * The set function adds a key-value pair to the hash table, handling collisions and resizing if necessary.
40
- * @param {K} key - The key parameter represents the key of the key-value pair that you want to insert into the hash
41
- * table. It is of type K, which is a generic type representing the key's data type.
42
- * @param {V} value - The parameter `value` represents the value that you want to associate with the given key in the hash
43
- * table.
44
- * @returns Nothing is being returned. The return type of the `put` method is `void`, which means it does not return any
45
- * value.
46
- */
47
- set(key, value) {
48
- const index = this._hash(key);
49
- const newNode = new HashTableNode(key, value);
50
- if (!this._buckets[index]) {
51
- this._buckets[index] = newNode;
52
- }
53
- else {
54
- // Handle collisions, consider using open addressing, etc.
55
- let currentNode = this._buckets[index];
56
- while (currentNode) {
57
- if (currentNode.key === key) {
58
- // If the key already exists, update the value
59
- currentNode.value = value;
60
- return;
61
- }
62
- if (!currentNode.next) {
63
- break;
64
- }
65
- currentNode = currentNode.next;
66
- }
67
- // Add to the end of the linked list
68
- currentNode.next = newNode;
69
- }
70
- this._size++;
71
- // If the load factor is too high, resize the hash table
72
- if (this._size / this._capacity >= HashTable.LOAD_FACTOR) {
73
- this._expand();
74
- }
75
- }
76
- /**
77
- * The `get` function retrieves the value associated with a given key from a hash table.
78
- * @param {K} key - The `key` parameter represents the key of the element that we want to retrieve from the data
79
- * structure.
80
- * @returns The method is returning the value associated with the given key if it exists in the hash table. If the key is
81
- * not found, it returns `undefined`.
82
- */
83
- get(key) {
84
- const index = this._hash(key);
85
- let currentNode = this._buckets[index];
86
- while (currentNode) {
87
- if (currentNode.key === key) {
88
- return currentNode.value;
89
- }
90
- currentNode = currentNode.next;
91
- }
92
- return undefined; // Key not found
93
- }
94
- /**
95
- * The delete function removes a key-value pair from a hash table.
96
- * @param {K} key - The `key` parameter represents the key of the key-value pair that needs to be removed from the hash
97
- * table.
98
- * @returns Nothing is being returned. The `delete` method has a return type of `void`, which means it does not return
99
- * any value.
100
- */
101
- delete(key) {
102
- const index = this._hash(key);
103
- let currentNode = this._buckets[index];
104
- let prevNode = undefined;
105
- while (currentNode) {
106
- if (currentNode.key === key) {
107
- if (prevNode) {
108
- prevNode.next = currentNode.next;
109
- }
110
- else {
111
- this._buckets[index] = currentNode.next;
112
- }
113
- this._size--;
114
- currentNode.next = undefined; // Release memory
115
- return;
116
- }
117
- prevNode = currentNode;
118
- currentNode = currentNode.next;
119
- }
120
- }
121
- *[Symbol.iterator]() {
122
- for (const bucket of this._buckets) {
123
- let currentNode = bucket;
124
- while (currentNode) {
125
- yield [currentNode.key, currentNode.value];
126
- currentNode = currentNode.next;
127
- }
128
- }
129
- }
130
- forEach(callback) {
131
- let index = 0;
132
- for (const entry of this) {
133
- callback(entry, index, this);
134
- index++;
135
- }
136
- }
137
- filter(predicate) {
138
- const newTable = new HashTable();
139
- let index = 0;
140
- for (const [key, value] of this) {
141
- if (predicate([key, value], index, this)) {
142
- newTable.set(key, value);
143
- }
144
- index++;
145
- }
146
- return newTable;
147
- }
148
- map(callback) {
149
- const newTable = new HashTable();
150
- let index = 0;
151
- for (const [key, value] of this) {
152
- newTable.set(key, callback([key, value], index, this));
153
- index++;
154
- }
155
- return newTable;
156
- }
157
- reduce(callback, initialValue) {
158
- let accumulator = initialValue;
159
- let index = 0;
160
- for (const entry of this) {
161
- accumulator = callback(accumulator, entry, index, this);
162
- index++;
163
- }
164
- return accumulator;
165
- }
166
- /**
167
- * The function `_defaultHashFn` calculates the hash value of a given key and returns the remainder when divided by the
168
- * capacity of the data structure.
169
- * @param {K} key - The `key` parameter is the input value that needs to be hashed. It can be of any type, but in this
170
- * code snippet, it is checked whether the key is a string or an object. If it is a string, the `_murmurStringHashFn`
171
- * function is used to
172
- * @returns the hash value of the key modulo the capacity of the data structure.
173
- */
174
- _defaultHashFn(key) {
175
- // Can be replaced with other hash functions as needed
176
- const hashValue = typeof key === 'string' ? this._murmurStringHashFn(key) : this._objectHash(key);
177
- return hashValue % this._capacity;
178
- }
179
- /**
180
- * The `_multiplicativeStringHashFn` function calculates a hash value for a given string key using the multiplicative
181
- * string hash function.
182
- * @param {K} key - The `key` parameter is the input value for which we want to calculate the hash. It can be of any
183
- * type, as it is generic (`K`). The function converts the `key` to a string using the `String()` function.
184
- * @returns a number, which is the result of the multiplicative string hash function applied to the input key.
185
- */
186
- _multiplicativeStringHashFn(key) {
187
- const keyString = String(key);
188
- let hash = 0;
189
- for (let i = 0; i < keyString.length; i++) {
190
- const charCode = keyString.charCodeAt(i);
191
- // Some constants for adjusting the hash function
192
- const A = 0.618033988749895;
193
- const M = 1 << 30; // 2^30
194
- hash = (hash * A + charCode) % M;
195
- }
196
- return Math.abs(hash); // Take absolute value to ensure non-negative numbers
197
- }
198
- /**
199
- * The function `_murmurStringHashFn` calculates a hash value for a given string key using the MurmurHash algorithm.
200
- * @param {K} key - The `key` parameter is the input value for which you want to calculate the hash. It can be of any
201
- * type, but it will be converted to a string using the `String()` function before calculating the hash.
202
- * @returns a number, which is the hash value calculated for the given key.
203
- */
204
- _murmurStringHashFn(key) {
205
- const keyString = String(key);
206
- const seed = 0;
207
- let hash = seed;
208
- for (let i = 0; i < keyString.length; i++) {
209
- const char = keyString.charCodeAt(i);
210
- hash = (hash ^ char) * 0x5bd1e995;
211
- hash = (hash ^ (hash >>> 15)) * 0x27d4eb2d;
212
- hash = hash ^ (hash >>> 15);
213
- }
214
- return Math.abs(hash);
215
- }
216
- /**
217
- * The _hash function takes a key and returns a number.
218
- * @param {K} key - The parameter "key" is of type K, which represents the type of the key that will be hashed.
219
- * @returns The hash function is returning a number.
220
- */
221
- _hash(key) {
222
- return this.hashFn(key);
223
- }
224
- /**
225
- * The function calculates a hash value for a given string using the djb2 algorithm.
226
- * @param {string} key - The `key` parameter in the `stringHash` function is a string value that represents the input for
227
- * which we want to calculate the hash value.
228
- * @returns a number, which is the hash value of the input string.
229
- */
230
- _stringHash(key) {
231
- let hash = 0;
232
- for (let i = 0; i < key.length; i++) {
233
- hash = (hash * 31 + key.charCodeAt(i)) & 0xffffffff;
234
- }
235
- return hash;
236
- }
237
- /**
238
- * The function `_objectHash` takes a key and returns a hash value, using a custom hash function for objects.
239
- * @param {K} key - The parameter "key" is of type "K", which means it can be any type. It could be a string, number,
240
- * boolean, object, or any other type of value. The purpose of the objectHash function is to generate a hash value for
241
- * the key, which can be used for
242
- * @returns a number, which is the hash value of the key.
243
- */
244
- _objectHash(key) {
245
- // If the key is an object, you can write a custom hash function
246
- // For example, convert the object's properties to a string and use string hashing
247
- // This is just an example; you should write a specific object hash function as needed
248
- return this._stringHash(JSON.stringify(key));
249
- }
250
- /**
251
- * The `expand` function increases the capacity of a hash table by creating a new array of buckets with double the
252
- * capacity and rehashing all the existing key-value pairs into the new buckets.
253
- */
254
- _expand() {
255
- const newCapacity = this._capacity * 2;
256
- const newBuckets = new Array(newCapacity).fill(undefined);
257
- for (const bucket of this._buckets) {
258
- let currentNode = bucket;
259
- while (currentNode) {
260
- const newIndex = this._hash(currentNode.key);
261
- const newNode = new HashTableNode(currentNode.key, currentNode.value);
262
- if (!newBuckets[newIndex]) {
263
- newBuckets[newIndex] = newNode;
264
- }
265
- else {
266
- let currentNewNode = newBuckets[newIndex];
267
- while (currentNewNode.next) {
268
- currentNewNode = currentNewNode.next;
269
- }
270
- currentNewNode.next = newNode;
271
- }
272
- currentNode = currentNode.next;
273
- }
274
- }
275
- this._buckets = newBuckets;
276
- this._capacity = newCapacity;
277
- }
278
- }
279
- exports.HashTable = HashTable;
280
- HashTable.DEFAULT_CAPACITY = 16;
281
- HashTable.LOAD_FACTOR = 0.75;
282
- //# sourceMappingURL=hash-table.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hash-table.js","sourceRoot":"","sources":["../../../../src/data-structures/hash/hash-table.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAIH,MAAa,aAAa;IAKxB,YAAY,GAAM,EAAE,KAAQ;QAC1B,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC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c,CAAC,IAAI,GAAG,OAAO,CAAC;gBAChC,CAAC;gBACD,WAAW,GAAG,WAAW,CAAC,IAAI,CAAC;YACjC,CAAC;QACH,CAAC;QAED,IAAI,CAAC,QAAQ,GAAG,UAAU,CAAC;QAC3B,IAAI,CAAC,SAAS,GAAG,WAAW,CAAC;IAC/B,CAAC;;AAtSH,8BAuSC;AAtS2B,0BAAgB,GAAG,EAAE,CAAC;AACtB,qBAAW,GAAG,IAAI,CAAC"}
@@ -1 +0,0 @@
1
- export {};
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=hash-table.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hash-table.js","sourceRoot":"","sources":["../../../../../src/types/data-structures/hash/hash-table.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- export {};
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=matrix2d.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"matrix2d.js","sourceRoot":"","sources":["../../../../../src/types/data-structures/matrix/matrix2d.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- export {};
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=vector2d.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"vector2d.js","sourceRoot":"","sources":["../../../../../src/types/data-structures/matrix/vector2d.ts"],"names":[],"mappings":""}