linked-list-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.
- package/dist/data-structures/binary-tree/avl-tree.d.ts +6 -6
- package/dist/data-structures/binary-tree/avl-tree.js +1 -1
- package/dist/data-structures/binary-tree/binary-tree.d.ts +45 -33
- package/dist/data-structures/binary-tree/binary-tree.js +80 -30
- package/dist/data-structures/binary-tree/bst.d.ts +6 -6
- package/dist/data-structures/binary-tree/bst.js +1 -1
- package/dist/data-structures/binary-tree/rb-tree.d.ts +3 -3
- package/dist/data-structures/binary-tree/tree-multiset.d.ts +6 -6
- package/dist/data-structures/binary-tree/tree-multiset.js +2 -2
- package/dist/interfaces/binary-tree.d.ts +2 -2
- package/package.json +2 -2
- package/src/data-structures/binary-tree/avl-tree.ts +10 -11
- package/src/data-structures/binary-tree/binary-indexed-tree.ts +1 -1
- package/src/data-structures/binary-tree/binary-tree.ts +107 -52
- package/src/data-structures/binary-tree/bst.ts +9 -9
- package/src/data-structures/binary-tree/rb-tree.ts +4 -7
- package/src/data-structures/binary-tree/tree-multiset.ts +10 -14
- package/src/data-structures/graph/abstract-graph.ts +10 -11
- package/src/data-structures/graph/directed-graph.ts +1 -2
- package/src/data-structures/graph/undirected-graph.ts +4 -5
- package/src/data-structures/hash/hash-map.ts +1 -1
- package/src/data-structures/hash/tree-map.ts +2 -1
- package/src/data-structures/hash/tree-set.ts +2 -1
- package/src/data-structures/linked-list/singly-linked-list.ts +1 -1
- package/src/data-structures/matrix/matrix.ts +1 -1
- package/src/data-structures/matrix/vector2d.ts +2 -1
- package/src/data-structures/queue/deque.ts +5 -4
- package/src/data-structures/queue/queue.ts +1 -1
- package/src/interfaces/binary-tree.ts +2 -2
- package/src/types/data-structures/matrix/navigator.ts +1 -1
- package/src/types/utils/utils.ts +1 -1
- package/src/types/utils/validate-type.ts +2 -2
|
@@ -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
|
}
|
|
@@ -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
|
|
|
@@ -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<
|
|
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;
|
package/src/types/utils/utils.ts
CHANGED
|
@@ -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
|
|