data-structure-typed 1.39.5 → 1.39.6

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 (107) hide show
  1. package/CHANGELOG.md +2 -1
  2. package/dist/cjs/data-structures/binary-tree/avl-tree.d.ts +6 -6
  3. package/dist/cjs/data-structures/binary-tree/avl-tree.js +13 -13
  4. package/dist/cjs/data-structures/binary-tree/avl-tree.js.map +1 -1
  5. package/dist/cjs/data-structures/binary-tree/binary-tree.d.ts +7 -7
  6. package/dist/cjs/data-structures/binary-tree/binary-tree.js +17 -17
  7. package/dist/cjs/data-structures/binary-tree/binary-tree.js.map +1 -1
  8. package/dist/cjs/data-structures/binary-tree/bst.d.ts +6 -6
  9. package/dist/cjs/data-structures/binary-tree/bst.js +13 -13
  10. package/dist/cjs/data-structures/binary-tree/bst.js.map +1 -1
  11. package/dist/cjs/data-structures/binary-tree/rb-tree.d.ts +2 -2
  12. package/dist/cjs/data-structures/binary-tree/rb-tree.js +4 -4
  13. package/dist/cjs/data-structures/binary-tree/rb-tree.js.map +1 -1
  14. package/dist/cjs/data-structures/binary-tree/segment-tree.d.ts +7 -7
  15. package/dist/cjs/data-structures/binary-tree/segment-tree.js +16 -16
  16. package/dist/cjs/data-structures/binary-tree/segment-tree.js.map +1 -1
  17. package/dist/cjs/data-structures/binary-tree/tree-multiset.d.ts +6 -6
  18. package/dist/cjs/data-structures/binary-tree/tree-multiset.js +18 -18
  19. package/dist/cjs/data-structures/binary-tree/tree-multiset.js.map +1 -1
  20. package/dist/cjs/data-structures/graph/abstract-graph.d.ts +17 -17
  21. package/dist/cjs/data-structures/graph/abstract-graph.js +24 -24
  22. package/dist/cjs/data-structures/graph/abstract-graph.js.map +1 -1
  23. package/dist/cjs/data-structures/graph/directed-graph.d.ts +12 -12
  24. package/dist/cjs/data-structures/graph/directed-graph.js +15 -15
  25. package/dist/cjs/data-structures/graph/directed-graph.js.map +1 -1
  26. package/dist/cjs/data-structures/graph/map-graph.d.ts +9 -9
  27. package/dist/cjs/data-structures/graph/map-graph.js +13 -13
  28. package/dist/cjs/data-structures/graph/map-graph.js.map +1 -1
  29. package/dist/cjs/data-structures/graph/undirected-graph.d.ts +11 -11
  30. package/dist/cjs/data-structures/graph/undirected-graph.js +14 -14
  31. package/dist/cjs/data-structures/graph/undirected-graph.js.map +1 -1
  32. package/dist/cjs/data-structures/hash/hash-table.d.ts +4 -4
  33. package/dist/cjs/data-structures/hash/hash-table.js +8 -8
  34. package/dist/cjs/data-structures/hash/hash-table.js.map +1 -1
  35. package/dist/cjs/data-structures/linked-list/doubly-linked-list.d.ts +31 -31
  36. package/dist/cjs/data-structures/linked-list/doubly-linked-list.js +54 -54
  37. package/dist/cjs/data-structures/linked-list/doubly-linked-list.js.map +1 -1
  38. package/dist/cjs/data-structures/linked-list/singly-linked-list.d.ts +24 -24
  39. package/dist/cjs/data-structures/linked-list/singly-linked-list.js +52 -52
  40. package/dist/cjs/data-structures/linked-list/singly-linked-list.js.map +1 -1
  41. package/dist/cjs/data-structures/queue/queue.js +1 -1
  42. package/dist/cjs/data-structures/queue/queue.js.map +1 -1
  43. package/dist/cjs/interfaces/binary-tree.d.ts +2 -2
  44. package/dist/cjs/interfaces/graph.d.ts +2 -2
  45. package/dist/mjs/data-structures/binary-tree/avl-tree.d.ts +6 -6
  46. package/dist/mjs/data-structures/binary-tree/avl-tree.js +13 -13
  47. package/dist/mjs/data-structures/binary-tree/binary-tree.d.ts +7 -7
  48. package/dist/mjs/data-structures/binary-tree/binary-tree.js +18 -18
  49. package/dist/mjs/data-structures/binary-tree/bst.d.ts +6 -6
  50. package/dist/mjs/data-structures/binary-tree/bst.js +13 -13
  51. package/dist/mjs/data-structures/binary-tree/rb-tree.d.ts +2 -2
  52. package/dist/mjs/data-structures/binary-tree/rb-tree.js +4 -4
  53. package/dist/mjs/data-structures/binary-tree/segment-tree.d.ts +7 -7
  54. package/dist/mjs/data-structures/binary-tree/segment-tree.js +16 -16
  55. package/dist/mjs/data-structures/binary-tree/tree-multiset.d.ts +6 -6
  56. package/dist/mjs/data-structures/binary-tree/tree-multiset.js +18 -18
  57. package/dist/mjs/data-structures/graph/abstract-graph.d.ts +17 -17
  58. package/dist/mjs/data-structures/graph/abstract-graph.js +26 -26
  59. package/dist/mjs/data-structures/graph/directed-graph.d.ts +12 -12
  60. package/dist/mjs/data-structures/graph/directed-graph.js +15 -15
  61. package/dist/mjs/data-structures/graph/map-graph.d.ts +9 -9
  62. package/dist/mjs/data-structures/graph/map-graph.js +13 -13
  63. package/dist/mjs/data-structures/graph/undirected-graph.d.ts +11 -11
  64. package/dist/mjs/data-structures/graph/undirected-graph.js +14 -14
  65. package/dist/mjs/data-structures/hash/hash-table.d.ts +4 -4
  66. package/dist/mjs/data-structures/hash/hash-table.js +9 -9
  67. package/dist/mjs/data-structures/linked-list/doubly-linked-list.d.ts +31 -31
  68. package/dist/mjs/data-structures/linked-list/doubly-linked-list.js +55 -55
  69. package/dist/mjs/data-structures/linked-list/singly-linked-list.d.ts +24 -24
  70. package/dist/mjs/data-structures/linked-list/singly-linked-list.js +53 -53
  71. package/dist/mjs/data-structures/queue/queue.js +1 -1
  72. package/dist/mjs/interfaces/binary-tree.d.ts +2 -2
  73. package/dist/mjs/interfaces/graph.d.ts +2 -2
  74. package/dist/umd/data-structure-typed.min.js +1 -1
  75. package/dist/umd/data-structure-typed.min.js.map +1 -1
  76. package/package.json +5 -5
  77. package/src/data-structures/binary-tree/avl-tree.ts +13 -13
  78. package/src/data-structures/binary-tree/binary-tree.ts +18 -18
  79. package/src/data-structures/binary-tree/bst.ts +16 -16
  80. package/src/data-structures/binary-tree/rb-tree.ts +6 -6
  81. package/src/data-structures/binary-tree/segment-tree.ts +15 -15
  82. package/src/data-structures/binary-tree/tree-multiset.ts +18 -18
  83. package/src/data-structures/graph/abstract-graph.ts +34 -34
  84. package/src/data-structures/graph/directed-graph.ts +16 -16
  85. package/src/data-structures/graph/map-graph.ts +13 -13
  86. package/src/data-structures/graph/undirected-graph.ts +15 -15
  87. package/src/data-structures/hash/hash-table.ts +9 -9
  88. package/src/data-structures/linked-list/doubly-linked-list.ts +61 -61
  89. package/src/data-structures/linked-list/singly-linked-list.ts +58 -58
  90. package/src/data-structures/queue/queue.ts +1 -1
  91. package/src/interfaces/binary-tree.ts +2 -2
  92. package/src/interfaces/graph.ts +2 -2
  93. package/test/integration/bst.test.ts +2 -2
  94. package/test/unit/data-structures/binary-tree/avl-tree.test.ts +2 -2
  95. package/test/unit/data-structures/binary-tree/binary-index-tree.test.ts +3 -3
  96. package/test/unit/data-structures/binary-tree/binary-tree.test.ts +8 -8
  97. package/test/unit/data-structures/binary-tree/bst.test.ts +4 -4
  98. package/test/unit/data-structures/binary-tree/rb-tree.test.ts +3 -3
  99. package/test/unit/data-structures/binary-tree/tree-multiset.test.ts +2 -2
  100. package/test/unit/data-structures/graph/abstract-graph.test.ts +99 -2
  101. package/test/unit/data-structures/graph/directed-graph.test.ts +22 -12
  102. package/test/unit/data-structures/graph/undirected-graph.test.ts +8 -0
  103. package/test/unit/data-structures/hash/hash-table.test.ts +1 -1
  104. package/test/unit/data-structures/linked-list/doubly-linked-list.test.ts +30 -30
  105. package/test/unit/data-structures/linked-list/linked-list.test.ts +1 -1
  106. package/test/unit/data-structures/linked-list/singly-linked-list.test.ts +15 -15
  107. package/test/utils/big-o.ts +7 -7
@@ -2,12 +2,12 @@ import { BTNKey, RBColor, RBTreeNodeNested, RBTreeOptions } from '../../types';
2
2
  import { IBinaryTree } from '../../interfaces';
3
3
  import { BST, BSTNode } from './bst';
4
4
  export declare class RBTreeNode<V = any, N extends RBTreeNode<V, N> = RBTreeNodeNested<V>> extends BSTNode<V, N> {
5
- constructor(key: BTNKey, val?: V);
5
+ constructor(key: BTNKey, value?: V);
6
6
  private _color;
7
7
  get color(): RBColor;
8
8
  set color(value: RBColor);
9
9
  }
10
10
  export declare class RBTree<V, N extends RBTreeNode<V, N> = RBTreeNode<V, RBTreeNodeNested<V>>> extends BST<V, N> implements IBinaryTree<V, N> {
11
11
  constructor(options?: RBTreeOptions);
12
- createNode(key: BTNKey, val?: V): N;
12
+ createNode(key: BTNKey, value?: V): N;
13
13
  }
@@ -4,8 +4,8 @@ exports.RBTree = exports.RBTreeNode = void 0;
4
4
  const types_1 = require("../../types");
5
5
  const bst_1 = require("./bst");
6
6
  class RBTreeNode extends bst_1.BSTNode {
7
- constructor(key, val) {
8
- super(key, val);
7
+ constructor(key, value) {
8
+ super(key, value);
9
9
  this._color = types_1.RBColor.RED;
10
10
  }
11
11
  get color() {
@@ -20,8 +20,8 @@ class RBTree extends bst_1.BST {
20
20
  constructor(options) {
21
21
  super(options);
22
22
  }
23
- createNode(key, val) {
24
- return new RBTreeNode(key, val);
23
+ createNode(key, value) {
24
+ return new RBTreeNode(key, value);
25
25
  }
26
26
  }
27
27
  exports.RBTree = RBTree;
@@ -1 +1 @@
1
- {"version":3,"file":"rb-tree.js","sourceRoot":"","sources":["../../../../src/data-structures/binary-tree/rb-tree.ts"],"names":[],"mappings":";;;AAAA,uCAA6E;AAE7E,+BAAmC;AAEnC,MAAa,UAAsE,SAAQ,aAAa;IACtG,YAAY,GAAW,EAAE,GAAO;QAC9B,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QAChB,IAAI,CAAC,MAAM,GAAG,eAAO,CAAC,GAAG,CAAC;IAC5B,CAAC;IAID,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,IAAI,KAAK,CAAC,KAAc;QACtB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACtB,CAAC;CACF;AAfD,gCAeC;AAED,MAAa,MACX,SAAQ,SAAS;IAGjB,YAAY,OAAuB;QACjC,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,CAAC;IAEQ,UAAU,CAAC,GAAW,EAAE,GAAO;QACtC,OAAO,IAAI,UAAU,CAAC,GAAG,EAAE,GAAG,CAAM,CAAC;IACvC,CAAC;CA8UF;AAxVD,wBAwVC"}
1
+ {"version":3,"file":"rb-tree.js","sourceRoot":"","sources":["../../../../src/data-structures/binary-tree/rb-tree.ts"],"names":[],"mappings":";;;AAAA,uCAA6E;AAE7E,+BAAmC;AAEnC,MAAa,UAAsE,SAAQ,aAAa;IACtG,YAAY,GAAW,EAAE,KAAS;QAChC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAClB,IAAI,CAAC,MAAM,GAAG,eAAO,CAAC,GAAG,CAAC;IAC5B,CAAC;IAID,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,IAAI,KAAK,CAAC,KAAc;QACtB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACtB,CAAC;CACF;AAfD,gCAeC;AAED,MAAa,MACX,SAAQ,SAAS;IAGjB,YAAY,OAAuB;QACjC,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,CAAC;IAEQ,UAAU,CAAC,GAAW,EAAE,KAAS;QACxC,OAAO,IAAI,UAAU,CAAC,GAAG,EAAE,KAAK,CAAM,CAAC;IACzC,CAAC;CA8UF;AAxVD,wBAwVC"}
@@ -7,16 +7,16 @@
7
7
  */
8
8
  import type { SegmentTreeNodeVal } from '../../types';
9
9
  export declare class SegmentTreeNode {
10
- constructor(start: number, end: number, sum: number, val?: SegmentTreeNodeVal | null);
10
+ constructor(start: number, end: number, sum: number, value?: SegmentTreeNodeVal | null);
11
11
  private _start;
12
12
  get start(): number;
13
13
  set start(v: number);
14
14
  private _end;
15
15
  get end(): number;
16
16
  set end(v: number);
17
- private _val;
18
- get val(): SegmentTreeNodeVal | null;
19
- set val(v: SegmentTreeNodeVal | null);
17
+ private _value;
18
+ get value(): SegmentTreeNodeVal | null;
19
+ set value(v: SegmentTreeNodeVal | null);
20
20
  private _sum;
21
21
  get sum(): number;
22
22
  set sum(v: number);
@@ -62,12 +62,12 @@ export declare class SegmentTree {
62
62
  * updated.
63
63
  * @param {number} sum - The `sum` parameter represents the new value that should be assigned to the `sum` property of
64
64
  * the `SegmentTreeNode` at the specified `index`.
65
- * @param {SegmentTreeNodeVal} [val] - The `val` parameter is an optional value that can be assigned to the `val`
65
+ * @param {SegmentTreeNodeVal} [value] - The `value` parameter is an optional value that can be assigned to the `value`
66
66
  * property of the `SegmentTreeNode` object. It is not currently used in the code, but you can uncomment the line `//
67
- * cur.val = val;` and pass a value for `val` in the
67
+ * cur.value = value;` and pass a value for `value` in the
68
68
  * @returns The function does not return anything.
69
69
  */
70
- updateNode(index: number, sum: number, val?: SegmentTreeNodeVal): void;
70
+ updateNode(index: number, sum: number, value?: SegmentTreeNodeVal): void;
71
71
  /**
72
72
  * The function `querySumByRange` calculates the sum of values within a given range in a segment tree.
73
73
  * @param {number} indexA - The starting index of the range for which you want to calculate the sum.
@@ -9,17 +9,17 @@
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.SegmentTree = exports.SegmentTreeNode = void 0;
11
11
  class SegmentTreeNode {
12
- constructor(start, end, sum, val) {
12
+ constructor(start, end, sum, value) {
13
13
  this._start = 0;
14
14
  this._end = 0;
15
- this._val = null;
15
+ this._value = null;
16
16
  this._sum = 0;
17
17
  this._left = null;
18
18
  this._right = null;
19
19
  this._start = start;
20
20
  this._end = end;
21
21
  this._sum = sum;
22
- this._val = val || null;
22
+ this._value = value || null;
23
23
  }
24
24
  get start() {
25
25
  return this._start;
@@ -33,11 +33,11 @@ class SegmentTreeNode {
33
33
  set end(v) {
34
34
  this._end = v;
35
35
  }
36
- get val() {
37
- return this._val;
36
+ get value() {
37
+ return this._value;
38
38
  }
39
- set val(v) {
40
- this._val = v;
39
+ set value(v) {
40
+ this._value = v;
41
41
  }
42
42
  get sum() {
43
43
  return this._sum;
@@ -126,39 +126,39 @@ class SegmentTree {
126
126
  * updated.
127
127
  * @param {number} sum - The `sum` parameter represents the new value that should be assigned to the `sum` property of
128
128
  * the `SegmentTreeNode` at the specified `index`.
129
- * @param {SegmentTreeNodeVal} [val] - The `val` parameter is an optional value that can be assigned to the `val`
129
+ * @param {SegmentTreeNodeVal} [value] - The `value` parameter is an optional value that can be assigned to the `value`
130
130
  * property of the `SegmentTreeNode` object. It is not currently used in the code, but you can uncomment the line `//
131
- * cur.val = val;` and pass a value for `val` in the
131
+ * cur.value = value;` and pass a value for `value` in the
132
132
  * @returns The function does not return anything.
133
133
  */
134
- updateNode(index, sum, val) {
134
+ updateNode(index, sum, value) {
135
135
  const root = this.root || null;
136
136
  if (!root) {
137
137
  return;
138
138
  }
139
- const dfs = (cur, index, sum, val) => {
139
+ const dfs = (cur, index, sum, value) => {
140
140
  if (cur.start === cur.end && cur.start === index) {
141
141
  cur.sum = sum;
142
- if (val !== undefined)
143
- cur.val = val;
142
+ if (value !== undefined)
143
+ cur.value = value;
144
144
  return;
145
145
  }
146
146
  const mid = cur.start + Math.floor((cur.end - cur.start) / 2);
147
147
  if (index <= mid) {
148
148
  if (cur.left) {
149
- dfs(cur.left, index, sum, val);
149
+ dfs(cur.left, index, sum, value);
150
150
  }
151
151
  }
152
152
  else {
153
153
  if (cur.right) {
154
- dfs(cur.right, index, sum, val);
154
+ dfs(cur.right, index, sum, value);
155
155
  }
156
156
  }
157
157
  if (cur.left && cur.right) {
158
158
  cur.sum = cur.left.sum + cur.right.sum;
159
159
  }
160
160
  };
161
- dfs(root, index, sum, val);
161
+ dfs(root, index, sum, value);
162
162
  }
163
163
  /**
164
164
  * The function `querySumByRange` calculates the sum of values within a given range in a segment tree.
@@ -1 +1 @@
1
- {"version":3,"file":"segment-tree.js","sourceRoot":"","sources":["../../../../src/data-structures/binary-tree/segment-tree.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAIH,MAAa,eAAe;IAC1B,YAAY,KAAa,EAAE,GAAW,EAAE,GAAW,EAAE,GAA+B;QAO5E,WAAM,GAAG,CAAC,CAAC;QASX,SAAI,GAAG,CAAC,CAAC;QAUT,SAAI,GAA8B,IAAI,CAAC;QAUvC,SAAI,GAAG,CAAC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BAC5B;qBAAM;oBACL,OAAO,GAAG,CAAC;iBACZ;aACF;iBAAM,IAAI,CAAC,GAAG,GAAG,EAAE;gBAClB,IAAI,GAAG,CAAC,KAAK,EAAE;oBACb,OAAO,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;iBAC7B;qBAAM;oBACL,OAAO,GAAG,CAAC;iBACZ;aACF;iBAAM;gBACL,qCAAqC;gBACrC,IAAI,OAAO,GAAG,CAAC,CAAC;gBAChB,IAAI,QAAQ,GAAG,CAAC,CAAC;gBACjB,IAAI,GAAG,CAAC,IAAI,EAAE;oBACZ,OAAO,GAAG,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC;iBACjC;gBACD,IAAI,GAAG,CAAC,KAAK,EAAE;oBACb,QAAQ,GAAG,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;iBACvC;gBACD,OAAO,OAAO,GAAG,QAAQ,CAAC;aAC3B;QACH,CAAC,CAAC;QACF,OAAO,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,CAAC;IAES,UAAU,CAAC,KAAe;QAClC,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;IACvB,CAAC;IAES,SAAS,CAAC,KAAa;QAC/B,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACtB,CAAC;IAES,OAAO,CAAC,KAAa;QAC7B,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC;IACpB,CAAC;IAES,QAAQ,CAAC,CAAyB;QAC1C,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;IACjB,CAAC;CACF;AAlLD,kCAkLC"}
1
+ {"version":3,"file":"segment-tree.js","sourceRoot":"","sources":["../../../../src/data-structures/binary-tree/segment-tree.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAIH,MAAa,eAAe;IAC1B,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ACjB,CAAC;CACF;AAlLD,kCAkLC"}
@@ -15,13 +15,13 @@ export declare class TreeMultisetNode<V = any, N extends TreeMultisetNode<V, N>
15
15
  * The constructor function initializes a BinaryTreeNode object with a key, value, and count.
16
16
  * @param {BTNKey} key - The `key` parameter is of type `BTNKey` and represents the unique identifier
17
17
  * of the binary tree node.
18
- * @param {V} [val] - The `val` parameter is an optional parameter of type `V`. It represents the value of the binary
18
+ * @param {V} [value] - The `value` parameter is an optional parameter of type `V`. It represents the value of the binary
19
19
  * tree node. If no value is provided, it will be `undefined`.
20
20
  * @param {number} [count=1] - The `count` parameter is a number that represents the number of times a particular value
21
21
  * occurs in a binary tree node. It has a default value of 1, which means that if no value is provided for the `count`
22
22
  * parameter when creating a new instance of the `BinaryTreeNode` class.
23
23
  */
24
- constructor(key: BTNKey, val?: V, count?: number);
24
+ constructor(key: BTNKey, value?: V, count?: number);
25
25
  }
26
26
  /**
27
27
  * The only distinction between a TreeMultiset and a AVLTree lies in the ability of the former to store duplicate nodes through the utilization of counters.
@@ -40,26 +40,26 @@ export declare class TreeMultiset<V = any, N extends TreeMultisetNode<V, N> = Tr
40
40
  * The function creates a new BSTNode with the given key, value, and count.
41
41
  * @param {BTNKey} key - The key parameter is the unique identifier for the binary tree node. It is used to
42
42
  * distinguish one node from another in the tree.
43
- * @param {N} val - The `val` parameter represents the value that will be stored in the binary search tree node.
43
+ * @param {N} value - The `value` parameter represents the value that will be stored in the binary search tree node.
44
44
  * @param {number} [count] - The "count" parameter is an optional parameter of type number. It represents the number of
45
45
  * occurrences of the value in the binary search tree node. If not provided, the count will default to 1.
46
46
  * @returns A new instance of the BSTNode class with the specified key, value, and count (if provided).
47
47
  */
48
- createNode(key: BTNKey, val?: V, count?: number): N;
48
+ createNode(key: BTNKey, value?: V, count?: number): N;
49
49
  /**
50
50
  * The `add` function adds a new node to a binary search tree, updating the count if the key already
51
51
  * exists, and balancing the tree if necessary.
52
52
  * @param {BTNKey | N | null} keyOrNode - The `keyOrNode` parameter can be either a
53
53
  * `BTNKey` (which represents the key of the node to be added), a `N` (which represents a
54
54
  * node to be added), or `null` (which represents a null node).
55
- * @param [val] - The `val` parameter represents the value associated with the key that is being
55
+ * @param [value] - The `value` parameter represents the value associated with the key that is being
56
56
  * added to the binary tree.
57
57
  * @param [count=1] - The `count` parameter represents the number of occurrences of the key/value
58
58
  * pair that will be added to the binary tree. It has a default value of 1, which means that if no
59
59
  * count is specified, the default count will be 1.
60
60
  * @returns The function `add` returns a value of type `N | null | undefined`.
61
61
  */
62
- add(keyOrNode: BTNKey | N | null, val?: V, count?: number): N | null | undefined;
62
+ add(keyOrNode: BTNKey | N | null, value?: V, count?: number): N | null | undefined;
63
63
  /**
64
64
  * The function adds a new node to a binary tree if there is an available slot in the parent node.
65
65
  * @param {N | null} newNode - The `newNode` parameter represents the node that needs to be added to
@@ -8,14 +8,14 @@ class TreeMultisetNode extends avl_tree_1.AVLTreeNode {
8
8
  * The constructor function initializes a BinaryTreeNode object with a key, value, and count.
9
9
  * @param {BTNKey} key - The `key` parameter is of type `BTNKey` and represents the unique identifier
10
10
  * of the binary tree node.
11
- * @param {V} [val] - The `val` parameter is an optional parameter of type `V`. It represents the value of the binary
11
+ * @param {V} [value] - The `value` parameter is an optional parameter of type `V`. It represents the value of the binary
12
12
  * tree node. If no value is provided, it will be `undefined`.
13
13
  * @param {number} [count=1] - The `count` parameter is a number that represents the number of times a particular value
14
14
  * occurs in a binary tree node. It has a default value of 1, which means that if no value is provided for the `count`
15
15
  * parameter when creating a new instance of the `BinaryTreeNode` class.
16
16
  */
17
- constructor(key, val, count = 1) {
18
- super(key, val);
17
+ constructor(key, value, count = 1) {
18
+ super(key, value);
19
19
  this.count = count;
20
20
  }
21
21
  }
@@ -41,13 +41,13 @@ class TreeMultiset extends avl_tree_1.AVLTree {
41
41
  * The function creates a new BSTNode with the given key, value, and count.
42
42
  * @param {BTNKey} key - The key parameter is the unique identifier for the binary tree node. It is used to
43
43
  * distinguish one node from another in the tree.
44
- * @param {N} val - The `val` parameter represents the value that will be stored in the binary search tree node.
44
+ * @param {N} value - The `value` parameter represents the value that will be stored in the binary search tree node.
45
45
  * @param {number} [count] - The "count" parameter is an optional parameter of type number. It represents the number of
46
46
  * occurrences of the value in the binary search tree node. If not provided, the count will default to 1.
47
47
  * @returns A new instance of the BSTNode class with the specified key, value, and count (if provided).
48
48
  */
49
- createNode(key, val, count) {
50
- return new TreeMultisetNode(key, val, count);
49
+ createNode(key, value, count) {
50
+ return new TreeMultisetNode(key, value, count);
51
51
  }
52
52
  /**
53
53
  * The `add` function adds a new node to a binary search tree, updating the count if the key already
@@ -55,23 +55,23 @@ class TreeMultiset extends avl_tree_1.AVLTree {
55
55
  * @param {BTNKey | N | null} keyOrNode - The `keyOrNode` parameter can be either a
56
56
  * `BTNKey` (which represents the key of the node to be added), a `N` (which represents a
57
57
  * node to be added), or `null` (which represents a null node).
58
- * @param [val] - The `val` parameter represents the value associated with the key that is being
58
+ * @param [value] - The `value` parameter represents the value associated with the key that is being
59
59
  * added to the binary tree.
60
60
  * @param [count=1] - The `count` parameter represents the number of occurrences of the key/value
61
61
  * pair that will be added to the binary tree. It has a default value of 1, which means that if no
62
62
  * count is specified, the default count will be 1.
63
63
  * @returns The function `add` returns a value of type `N | null | undefined`.
64
64
  */
65
- add(keyOrNode, val, count = 1) {
65
+ add(keyOrNode, value, count = 1) {
66
66
  let inserted = undefined, newNode;
67
67
  if (keyOrNode instanceof TreeMultisetNode) {
68
- newNode = this.createNode(keyOrNode.key, keyOrNode.val, keyOrNode.count);
68
+ newNode = this.createNode(keyOrNode.key, keyOrNode.value, keyOrNode.count);
69
69
  }
70
70
  else if (keyOrNode === null) {
71
71
  newNode = null;
72
72
  }
73
73
  else {
74
- newNode = this.createNode(keyOrNode, val, count);
74
+ newNode = this.createNode(keyOrNode, value, count);
75
75
  }
76
76
  if (!this.root) {
77
77
  this._setRoot(newNode);
@@ -86,7 +86,7 @@ class TreeMultiset extends avl_tree_1.AVLTree {
86
86
  if (cur) {
87
87
  if (newNode) {
88
88
  if (this._compare(cur.key, newNode.key) === types_1.CP.eq) {
89
- cur.val = newNode.val;
89
+ cur.value = newNode.value;
90
90
  cur.count += newNode.count;
91
91
  this._setCount(this.count + newNode.count);
92
92
  traversing = false;
@@ -187,7 +187,7 @@ class TreeMultiset extends avl_tree_1.AVLTree {
187
187
  for (let i = 0; i < keysOrNodes.length; i++) {
188
188
  const keyOrNode = keysOrNodes[i];
189
189
  if (keyOrNode instanceof TreeMultisetNode) {
190
- inserted.push(this.add(keyOrNode.key, keyOrNode.val, keyOrNode.count));
190
+ inserted.push(this.add(keyOrNode.key, keyOrNode.value, keyOrNode.count));
191
191
  continue;
192
192
  }
193
193
  if (keyOrNode === null) {
@@ -217,7 +217,7 @@ class TreeMultiset extends avl_tree_1.AVLTree {
217
217
  return;
218
218
  const m = l + Math.floor((r - l) / 2);
219
219
  const midNode = sorted[m];
220
- this.add(midNode.key, midNode.val, midNode.count);
220
+ this.add(midNode.key, midNode.value, midNode.count);
221
221
  buildBalanceBST(l, m - 1);
222
222
  buildBalanceBST(m + 1, r);
223
223
  };
@@ -233,7 +233,7 @@ class TreeMultiset extends avl_tree_1.AVLTree {
233
233
  if (l <= r) {
234
234
  const m = l + Math.floor((r - l) / 2);
235
235
  const midNode = sorted[m];
236
- this.add(midNode.key, midNode.val, midNode.count);
236
+ this.add(midNode.key, midNode.value, midNode.count);
237
237
  stack.push([m + 1, r]);
238
238
  stack.push([l, m - 1]);
239
239
  }
@@ -329,16 +329,16 @@ class TreeMultiset extends avl_tree_1.AVLTree {
329
329
  * @returns The method is returning the `destNode` after swapping its properties with the `srcNode`.
330
330
  */
331
331
  _swap(srcNode, destNode) {
332
- const { key, val, count, height } = destNode;
333
- const tempNode = this.createNode(key, val, count);
332
+ const { key, value, count, height } = destNode;
333
+ const tempNode = this.createNode(key, value, count);
334
334
  if (tempNode) {
335
335
  tempNode.height = height;
336
336
  destNode.key = srcNode.key;
337
- destNode.val = srcNode.val;
337
+ destNode.value = srcNode.value;
338
338
  destNode.count = srcNode.count;
339
339
  destNode.height = srcNode.height;
340
340
  srcNode.key = tempNode.key;
341
- srcNode.val = tempNode.val;
341
+ srcNode.value = tempNode.value;
342
342
  srcNode.count = tempNode.count;
343
343
  srcNode.height = tempNode.height;
344
344
  }
@@ -1 +1 @@
1
- {"version":3,"file":"tree-multiset.js","sourceRoot":"","sources":["../../../../src/data-structures/binary-tree/tree-multiset.ts"],"names":[],"mappings":";;;AAQA,uCAAoG;AAEpG,yCAAgD;AAEhD,MAAa,gBAGX,SAAQ,sBAAiB;IAGzB;;;;;;;;;OASG;IACH,YAAY,GAAW,EAAE,GAAO,EAAE,KAAK,GAAG,CAAC;QACzC,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QAChB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;CACF;AApBD,4CAoBC;AAED;;GAEG;AACH,MAAa,YACX,SAAQ,kBAAa;IAGrB;;;;;OAKG;IACH,YAAY,OAA6B;QACvC,KAAK,CAAC,OAAO,CAAC,CAAC;QAGT,WAAM,GAAG,CAAC,CAAC;IAFnB,CAAC;IAID,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED;;;;;;;;OAQG;IACM,UAAU,CAAC,GAAW,EAAE,GAAO,EAAE,KAAc;QACtD,OAAO,IAAI,gBAAgB,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,CAAM,CAAC;IACpD,CAAC;IAED;;;;;;;;;;;;OAYG;IACM,GAAG,CAAC,SAA4B,EAAE,GAAO,EAAE,KAAK,GAAG,CAAC;QAC3D,IAAI,QAAQ,GAAyB,SAAS,EAC5C,OAAiB,CAAC;QACpB,IAAI,SAAS,YAAY,gBAAgB,EAAE;YACzC,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,GAAG,EAAE,SAAS,CAAC,GAAG,EAAE,SAAS,CAAC,KAAK,CAAC,CAA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CAAC,KAAK,EAAE,CAAC;QACd,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC;IAED;;;;;;OAMG;IACgB,KAAK,CAAC,OAAU,EAAE,QAAW;QAC9C,MAAM,EAAC,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAC,GAAG,QAAQ,CAAC;QAC7C,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;QACpD,IAAI,QAAQ,EAAE;YACZ,QAAQ,CAAC,MAAM,GAAG,MAAM,CAAC;YAEzB,QAAQ,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;YAC3B,QAAQ,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;YAC/B,QAAQ,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;YAC/B,QAAQ,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;YAEjC,OAAO,CAAC,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC;YAC3B,OAAO,CAAC,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC;YAC/B,OAAO,CAAC,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC;YAC/B,OAAO,CAAC,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC;SAClC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;;OAGG;IACO,SAAS,CAAC,CAAS;QAC3B,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;IAClB,CAAC;CACF;AAtVD,oCAsVC"}
@@ -5,31 +5,31 @@ export declare abstract class AbstractVertex<V = any> {
5
5
  * The function is a protected constructor that takes an key and an optional value as parameters.
6
6
  * @param {VertexKey} key - The `key` parameter is of type `VertexKey` and represents the identifier of the vertex. It is
7
7
  * used to uniquely identify the vertex object.
8
- * @param {V} [val] - The parameter "val" is an optional parameter of type V. It is used to assign a value to the
8
+ * @param {V} [value] - The parameter "value" is an optional parameter of type V. It is used to assign a value to the
9
9
  * vertex. If no value is provided, it will be set to undefined.
10
10
  */
11
- protected constructor(key: VertexKey, val?: V);
11
+ protected constructor(key: VertexKey, value?: V);
12
12
  private _key;
13
13
  get key(): VertexKey;
14
14
  set key(v: VertexKey);
15
- private _val;
16
- get val(): V | undefined;
17
- set val(value: V | undefined);
15
+ private _value;
16
+ get value(): V | undefined;
17
+ set value(value: V | undefined);
18
18
  }
19
- export declare abstract class AbstractEdge<VO = any> {
19
+ export declare abstract class AbstractEdge<E = any> {
20
20
  /**
21
21
  * The above function is a protected constructor that initializes the weight, value, and hash code properties of an
22
22
  * object.
23
23
  * @param {number} [weight] - The `weight` parameter is an optional number that represents the weight of the object. If
24
24
  * a value is provided, it will be assigned to the `_weight` property. If no value is provided, the default value of 1
25
25
  * will be assigned.
26
- * @param {VO} [val] - The `val` parameter is of type `VO`, which means it can be any type. It is an optional parameter,
26
+ * @param {VO} [value] - The `value` parameter is of type `VO`, which means it can be any type. It is an optional parameter,
27
27
  * meaning it can be omitted when creating an instance of the class.
28
28
  */
29
- protected constructor(weight?: number, val?: VO);
30
- private _val;
31
- get val(): VO | undefined;
32
- set val(value: VO | undefined);
29
+ protected constructor(weight?: number, value?: E);
30
+ private _value;
31
+ get value(): E | undefined;
32
+ set value(value: E | undefined);
33
33
  private _weight;
34
34
  get weight(): number;
35
35
  set weight(v: number);
@@ -53,18 +53,18 @@ export declare abstract class AbstractGraph<V = any, E = any, VO extends Abstrac
53
53
  * In TypeScript, a subclass inherits the interface implementation of its parent class, without needing to implement the same interface again in the subclass. This behavior differs from Java's approach. In Java, if a parent class implements an interface, the subclass needs to explicitly implement the same interface, even if the parent class has already implemented it.
54
54
  * This means that using abstract methods in the parent class cannot constrain the grandchild classes. Defining methods within an interface also cannot constrain the descendant classes. When inheriting from this class, developers need to be aware that this method needs to be overridden.
55
55
  * @param key
56
- * @param val
56
+ * @param value
57
57
  */
58
- abstract createVertex(key: VertexKey, val?: V): VO;
58
+ abstract createVertex(key: VertexKey, value?: V): VO;
59
59
  /**
60
60
  * In TypeScript, a subclass inherits the interface implementation of its parent class, without needing to implement the same interface again in the subclass. This behavior differs from Java's approach. In Java, if a parent class implements an interface, the subclass needs to explicitly implement the same interface, even if the parent class has already implemented it.
61
61
  * This means that using abstract methods in the parent class cannot constrain the grandchild classes. Defining methods within an interface also cannot constrain the descendant classes. When inheriting from this class, developers need to be aware that this method needs to be overridden.
62
62
  * @param srcOrV1
63
63
  * @param destOrV2
64
64
  * @param weight
65
- * @param val
65
+ * @param value
66
66
  */
67
- abstract createEdge(srcOrV1: VertexKey | string, destOrV2: VertexKey | string, weight?: number, val?: E): EO;
67
+ abstract createEdge(srcOrV1: VertexKey, destOrV2: VertexKey, weight?: number, value?: E): EO;
68
68
  abstract deleteEdge(edge: EO): EO | null;
69
69
  abstract getEdge(srcOrKey: VO | VertexKey, destOrKey: VO | VertexKey): EO | null;
70
70
  abstract degreeOf(vertexOrKey: VO | VertexKey): number;
@@ -88,7 +88,7 @@ export declare abstract class AbstractGraph<V = any, E = any, VO extends Abstrac
88
88
  */
89
89
  hasVertex(vertexOrKey: VO | VertexKey): boolean;
90
90
  addVertex(vertex: VO): boolean;
91
- addVertex(key: VertexKey, val?: V): boolean;
91
+ addVertex(key: VertexKey, value?: V): boolean;
92
92
  /**
93
93
  * The `deleteVertex` function removes a vertex from a graph by its ID or by the vertex object itself.
94
94
  * @param {VO | VertexKey} vertexOrKey - The parameter `vertexOrKey` can be either a vertex object (`VO`) or a vertex ID
@@ -114,7 +114,7 @@ export declare abstract class AbstractGraph<V = any, E = any, VO extends Abstrac
114
114
  */
115
115
  hasEdge(v1: VertexKey | VO, v2: VertexKey | VO): boolean;
116
116
  addEdge(edge: EO): boolean;
117
- addEdge(src: VO | VertexKey, dest: VO | VertexKey, weight?: number, val?: E): boolean;
117
+ addEdge(src: VO | VertexKey, dest: VO | VertexKey, weight?: number, value?: E): boolean;
118
118
  /**
119
119
  * The function sets the weight of an edge between two vertices in a graph.
120
120
  * @param {VertexKey | VO} srcOrKey - The `srcOrKey` parameter can be either a `VertexKey` or a `VO` object. It represents
@@ -16,12 +16,12 @@ class AbstractVertex {
16
16
  * The function is a protected constructor that takes an key and an optional value as parameters.
17
17
  * @param {VertexKey} key - The `key` parameter is of type `VertexKey` and represents the identifier of the vertex. It is
18
18
  * used to uniquely identify the vertex object.
19
- * @param {V} [val] - The parameter "val" is an optional parameter of type V. It is used to assign a value to the
19
+ * @param {V} [value] - The parameter "value" is an optional parameter of type V. It is used to assign a value to the
20
20
  * vertex. If no value is provided, it will be set to undefined.
21
21
  */
22
- constructor(key, val) {
22
+ constructor(key, value) {
23
23
  this._key = key;
24
- this._val = val;
24
+ this._value = value;
25
25
  }
26
26
  get key() {
27
27
  return this._key;
@@ -29,11 +29,11 @@ class AbstractVertex {
29
29
  set key(v) {
30
30
  this._key = v;
31
31
  }
32
- get val() {
33
- return this._val;
32
+ get value() {
33
+ return this._value;
34
34
  }
35
- set val(value) {
36
- this._val = value;
35
+ set value(value) {
36
+ this._value = value;
37
37
  }
38
38
  }
39
39
  exports.AbstractVertex = AbstractVertex;
@@ -44,19 +44,19 @@ class AbstractEdge {
44
44
  * @param {number} [weight] - The `weight` parameter is an optional number that represents the weight of the object. If
45
45
  * a value is provided, it will be assigned to the `_weight` property. If no value is provided, the default value of 1
46
46
  * will be assigned.
47
- * @param {VO} [val] - The `val` parameter is of type `VO`, which means it can be any type. It is an optional parameter,
47
+ * @param {VO} [value] - The `value` parameter is of type `VO`, which means it can be any type. It is an optional parameter,
48
48
  * meaning it can be omitted when creating an instance of the class.
49
49
  */
50
- constructor(weight, val) {
50
+ constructor(weight, value) {
51
51
  this._weight = weight !== undefined ? weight : 1;
52
- this._val = val;
52
+ this._value = value;
53
53
  this._hashCode = (0, utils_1.uuidV4)();
54
54
  }
55
- get val() {
56
- return this._val;
55
+ get value() {
56
+ return this._value;
57
57
  }
58
- set val(value) {
59
- this._val = value;
58
+ set value(value) {
59
+ this._value = value;
60
60
  }
61
61
  get weight() {
62
62
  return this._weight;
@@ -107,12 +107,12 @@ class AbstractGraph {
107
107
  hasVertex(vertexOrKey) {
108
108
  return this._vertices.has(this._getVertexKey(vertexOrKey));
109
109
  }
110
- addVertex(keyOrVertex, val) {
110
+ addVertex(keyOrVertex, value) {
111
111
  if (keyOrVertex instanceof AbstractVertex) {
112
112
  return this._addVertexOnly(keyOrVertex);
113
113
  }
114
114
  else {
115
- const newVertex = this.createVertex(keyOrVertex, val);
115
+ const newVertex = this.createVertex(keyOrVertex, value);
116
116
  return this._addVertexOnly(newVertex);
117
117
  }
118
118
  }
@@ -152,7 +152,7 @@ class AbstractGraph {
152
152
  const edge = this.getEdge(v1, v2);
153
153
  return !!edge;
154
154
  }
155
- addEdge(srcOrEdge, dest, weight, val) {
155
+ addEdge(srcOrEdge, dest, weight, value) {
156
156
  if (srcOrEdge instanceof AbstractEdge) {
157
157
  return this._addEdgeOnly(srcOrEdge);
158
158
  }
@@ -164,7 +164,7 @@ class AbstractGraph {
164
164
  srcOrEdge = srcOrEdge.key;
165
165
  if (dest instanceof AbstractVertex)
166
166
  dest = dest.key;
167
- const newEdge = this.createEdge(srcOrEdge, dest, weight, val);
167
+ const newEdge = this.createEdge(srcOrEdge, dest, weight, value);
168
168
  return this._addEdgeOnly(newEdge);
169
169
  }
170
170
  else {
@@ -406,10 +406,10 @@ class AbstractGraph {
406
406
  const getMinOfNoSeen = () => {
407
407
  let min = Infinity;
408
408
  let minV = null;
409
- for (const [key, val] of distMap) {
409
+ for (const [key, value] of distMap) {
410
410
  if (!seen.has(key)) {
411
- if (val < min) {
412
- min = val;
411
+ if (value < min) {
412
+ min = value;
413
413
  minV = key;
414
414
  }
415
415
  }
@@ -530,7 +530,7 @@ class AbstractGraph {
530
530
  distMap.set(vertexOrKey, Infinity);
531
531
  }
532
532
  const heap = new priority_queue_1.PriorityQueue({ comparator: (a, b) => a.key - b.key });
533
- heap.add({ key: 0, val: srcVertex });
533
+ heap.add({ key: 0, value: srcVertex });
534
534
  distMap.set(srcVertex, 0);
535
535
  preMap.set(srcVertex, null);
536
536
  /**
@@ -558,7 +558,7 @@ class AbstractGraph {
558
558
  while (heap.size > 0) {
559
559
  const curHeapNode = heap.poll();
560
560
  const dist = curHeapNode === null || curHeapNode === void 0 ? void 0 : curHeapNode.key;
561
- const cur = curHeapNode === null || curHeapNode === void 0 ? void 0 : curHeapNode.val;
561
+ const cur = curHeapNode === null || curHeapNode === void 0 ? void 0 : curHeapNode.value;
562
562
  if (dist !== undefined) {
563
563
  if (cur) {
564
564
  seen.add(cur);
@@ -579,7 +579,7 @@ class AbstractGraph {
579
579
  const distSrcToNeighbor = distMap.get(neighbor);
580
580
  if (distSrcToNeighbor) {
581
581
  if (dist + weight < distSrcToNeighbor) {
582
- heap.add({ key: dist + weight, val: neighbor });
582
+ heap.add({ key: dist + weight, value: neighbor });
583
583
  preMap.set(neighbor, cur);
584
584
  distMap.set(neighbor, dist + weight);
585
585
  }