min-heap-typed 1.38.6 → 1.38.8

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 (32) hide show
  1. package/dist/data-structures/binary-tree/avl-tree.d.ts +6 -6
  2. package/dist/data-structures/binary-tree/avl-tree.js +1 -1
  3. package/dist/data-structures/binary-tree/binary-tree.d.ts +45 -33
  4. package/dist/data-structures/binary-tree/binary-tree.js +80 -30
  5. package/dist/data-structures/binary-tree/bst.d.ts +6 -6
  6. package/dist/data-structures/binary-tree/bst.js +1 -1
  7. package/dist/data-structures/binary-tree/rb-tree.d.ts +3 -3
  8. package/dist/data-structures/binary-tree/tree-multiset.d.ts +6 -6
  9. package/dist/data-structures/binary-tree/tree-multiset.js +2 -2
  10. package/dist/interfaces/binary-tree.d.ts +2 -2
  11. package/package.json +2 -2
  12. package/src/data-structures/binary-tree/avl-tree.ts +10 -11
  13. package/src/data-structures/binary-tree/binary-indexed-tree.ts +1 -1
  14. package/src/data-structures/binary-tree/binary-tree.ts +107 -52
  15. package/src/data-structures/binary-tree/bst.ts +9 -9
  16. package/src/data-structures/binary-tree/rb-tree.ts +4 -7
  17. package/src/data-structures/binary-tree/tree-multiset.ts +10 -14
  18. package/src/data-structures/graph/abstract-graph.ts +10 -11
  19. package/src/data-structures/graph/directed-graph.ts +1 -2
  20. package/src/data-structures/graph/undirected-graph.ts +4 -5
  21. package/src/data-structures/hash/hash-map.ts +1 -1
  22. package/src/data-structures/hash/tree-map.ts +2 -1
  23. package/src/data-structures/hash/tree-set.ts +2 -1
  24. package/src/data-structures/linked-list/singly-linked-list.ts +1 -1
  25. package/src/data-structures/matrix/matrix.ts +1 -1
  26. package/src/data-structures/matrix/vector2d.ts +2 -1
  27. package/src/data-structures/queue/deque.ts +5 -4
  28. package/src/data-structures/queue/queue.ts +1 -1
  29. package/src/interfaces/binary-tree.ts +2 -2
  30. package/src/types/data-structures/matrix/navigator.ts +1 -1
  31. package/src/types/utils/utils.ts +1 -1
  32. package/src/types/utils/validate-type.ts +2 -2
@@ -485,7 +485,7 @@ export class SinglyLinkedList<E = any> {
485
485
  return count;
486
486
  }
487
487
 
488
- *[Symbol.iterator]() {
488
+ * [Symbol.iterator]() {
489
489
  let current = this.head;
490
490
 
491
491
  while (current) {
@@ -14,7 +14,7 @@ export class MatrixNTI2D<V = any> {
14
14
  * given initial value or 0 if not provided.
15
15
  * @param options - An object containing the following properties:
16
16
  */
17
- constructor(options: {row: number; col: number; initialVal?: V}) {
17
+ constructor(options: { row: number; col: number; initialVal?: V }) {
18
18
  const {row, col, initialVal} = options;
19
19
  this._matrix = new Array(row).fill(undefined).map(() => new Array(col).fill(initialVal || 0));
20
20
  }
@@ -10,7 +10,8 @@ export class Vector2D {
10
10
  public x: number = 0,
11
11
  public y: number = 0,
12
12
  public w: number = 1 // needed for matrix multiplication
13
- ) {}
13
+ ) {
14
+ }
14
15
 
15
16
  /**
16
17
  * The function checks if the x and y values of a point are both zero.
@@ -9,7 +9,8 @@ import {DoublyLinkedList} from '../linked-list';
9
9
 
10
10
  // O(n) time complexity of obtaining the value
11
11
  // O(1) time complexity of adding at the beginning and the end
12
- export class Deque<E = any> extends DoublyLinkedList<E> {}
12
+ export class Deque<E = any> extends DoublyLinkedList<E> {
13
+ }
13
14
 
14
15
  // O(1) time complexity of obtaining the value
15
16
  // O(n) time complexity of adding at the beginning and the end
@@ -19,9 +20,9 @@ export class ObjectDeque<E = number> {
19
20
  if (capacity !== undefined) this._capacity = capacity;
20
21
  }
21
22
 
22
- private _nodes: {[key: number]: E} = {};
23
+ private _nodes: { [key: number]: E } = {};
23
24
 
24
- get nodes(): {[p: number]: E} {
25
+ get nodes(): { [p: number]: E } {
25
26
  return this._nodes;
26
27
  }
27
28
 
@@ -156,7 +157,7 @@ export class ObjectDeque<E = number> {
156
157
  return this._size <= 0;
157
158
  }
158
159
 
159
- protected _seNodes(value: {[p: number]: E}) {
160
+ protected _seNodes(value: { [p: number]: E }) {
160
161
  this._nodes = value;
161
162
  }
162
163
 
@@ -183,7 +183,7 @@ export class Queue<E = any> {
183
183
  return new Queue(this.nodes.slice(this.offset));
184
184
  }
185
185
 
186
- *[Symbol.iterator]() {
186
+ * [Symbol.iterator]() {
187
187
  for (const item of this.nodes) {
188
188
  yield item;
189
189
  }
@@ -1,7 +1,7 @@
1
1
  import {BinaryTreeNode} from '../data-structures';
2
- import {BinaryTreeDeletedResult, BinaryTreeNodeKey, MapCallback} from '../types';
2
+ import {BinaryTreeDeletedResult, BinaryTreeNodeKey, BinaryTreeNodeNested, MapCallback} from '../types';
3
3
 
4
- export interface IBinaryTree<N extends BinaryTreeNode<N['val'], N>> {
4
+ export interface IBinaryTree<V = any, N extends BinaryTreeNode<V, N> = BinaryTreeNodeNested<V>> {
5
5
  createNode(key: BinaryTreeNodeKey, val?: N['val']): N;
6
6
 
7
7
  add(keyOrNode: BinaryTreeNodeKey | N | null, val?: N['val']): N | null | undefined;
@@ -1,6 +1,6 @@
1
1
  export type Direction = 'up' | 'right' | 'down' | 'left';
2
2
 
3
- export type Turning = {[key in Direction]: Direction};
3
+ export type Turning = { [key in Direction]: Direction };
4
4
 
5
5
  export type NavigatorParams<T = any> = {
6
6
  matrix: T[][];
@@ -1,5 +1,5 @@
1
1
  export type ToThunkFn = () => ReturnType<TrlFn>;
2
- export type Thunk = () => ReturnType<ToThunkFn> & {__THUNK__: symbol};
2
+ export type Thunk = () => ReturnType<ToThunkFn> & { __THUNK__: symbol };
3
3
  export type TrlFn = (...args: any[]) => any;
4
4
  export type TrlAsyncFn = (...args: any[]) => any;
5
5
 
@@ -1,6 +1,6 @@
1
- export type KeyValueObject = {[key: string]: any};
1
+ export type KeyValueObject = { [key: string]: any };
2
2
 
3
- export type KeyValueObjectWithKey = {[key: string]: any; key: string | number | symbol};
3
+ export type KeyValueObjectWithKey = { [key: string]: any; key: string | number | symbol };
4
4
 
5
5
  export type NonNumberNonObjectButDefined = string | boolean | symbol | null;
6
6