priority-queue-typed
Advanced tools
Comparing version 1.46.8 to 1.46.9
@@ -9,3 +9,3 @@ /** | ||
import { BST, BSTNode } from './bst'; | ||
import type { AVLTreeNodeNested, AVLTreeOptions, BiTreeDeleteResult, BTNKey } from '../../types'; | ||
import type { AVLTreeNested, AVLTreeNodeNested, AVLTreeOptions, BiTreeDeleteResult, BTNKey } from '../../types'; | ||
import { BTNCallback } from '../../types'; | ||
@@ -17,3 +17,4 @@ import { IBinaryTree } from '../../interfaces'; | ||
} | ||
export declare class AVLTree<V = any, N extends AVLTreeNode<V, N> = AVLTreeNode<V, AVLTreeNodeNested<V>>> extends BST<V, N> implements IBinaryTree<V, N> { | ||
export declare class AVLTree<V = any, N extends AVLTreeNode<V, N> = AVLTreeNode<V, AVLTreeNodeNested<V>>, TREE extends AVLTree<V, N, TREE> = AVLTree<V, N, AVLTreeNested<V, N>>> extends BST<V, N, TREE> implements IBinaryTree<V, N, TREE> { | ||
options: AVLTreeOptions; | ||
/** | ||
@@ -36,2 +37,3 @@ * This is a constructor function for an AVL tree data structure in TypeScript. | ||
createNode(key: BTNKey, value?: V): N; | ||
createTree(options?: AVLTreeOptions): TREE; | ||
/** | ||
@@ -38,0 +40,0 @@ * Time Complexity: O(log n) - logarithmic time, where "n" is the number of nodes in the tree. The add method of the superclass (BST) has logarithmic time complexity. |
@@ -12,2 +12,3 @@ "use strict"; | ||
const bst_1 = require("./bst"); | ||
const types_1 = require("../../types"); | ||
class AVLTreeNode extends bst_1.BSTNode { | ||
@@ -29,2 +30,8 @@ constructor(key, value) { | ||
super(options); | ||
if (options) { | ||
this.options = Object.assign({ iterationType: types_1.IterationType.ITERATIVE, comparator: (a, b) => a - b }, options); | ||
} | ||
else { | ||
this.options = { iterationType: types_1.IterationType.ITERATIVE, comparator: (a, b) => a - b }; | ||
} | ||
} | ||
@@ -43,2 +50,5 @@ /** | ||
} | ||
createTree(options) { | ||
return new AVLTree(Object.assign(Object.assign({}, this.options), options)); | ||
} | ||
/** | ||
@@ -45,0 +55,0 @@ * Time Complexity: O(log n) - logarithmic time, where "n" is the number of nodes in the tree. The add method of the superclass (BST) has logarithmic time complexity. |
@@ -9,3 +9,3 @@ /** | ||
import type { BinaryTreeNodeNested, BinaryTreeOptions, BTNCallback, BTNKey } from '../../types'; | ||
import { BiTreeDeleteResult, DFSOrderPattern, FamilyPosition, IterationType } from '../../types'; | ||
import { BinaryTreeNested, BinaryTreePrintOptions, BiTreeDeleteResult, DFSOrderPattern, FamilyPosition, IterationType, NodeDisplayLayout } from '../../types'; | ||
import { IBinaryTree } from '../../interfaces'; | ||
@@ -66,4 +66,4 @@ /** | ||
*/ | ||
export declare class BinaryTree<V = any, N extends BinaryTreeNode<V, N> = BinaryTreeNode<V, BinaryTreeNodeNested<V>>> implements IBinaryTree<V, N> { | ||
iterationType: IterationType; | ||
export declare class BinaryTree<V = any, N extends BinaryTreeNode<V, N> = BinaryTreeNode<V, BinaryTreeNodeNested<V>>, TREE extends BinaryTree<V, N, TREE> = BinaryTree<V, N, BinaryTreeNested<V, N>>> implements IBinaryTree<V, N, TREE> { | ||
options: BinaryTreeOptions; | ||
/** | ||
@@ -91,2 +91,3 @@ * Creates a new instance of BinaryTree. | ||
createNode(key: BTNKey, value?: V): N; | ||
createTree(options?: BinaryTreeOptions): TREE; | ||
/** | ||
@@ -187,3 +188,3 @@ * Time Complexity: O(n) | ||
*/ | ||
getHeight(beginRoot?: BTNKey | N | null | undefined, iterationType?: IterationType): number; | ||
getHeight(beginRoot?: BTNKey | N | null | undefined, iterationType?: IterationType | undefined): number; | ||
/** | ||
@@ -207,3 +208,3 @@ * Time Complexity: O(n) | ||
*/ | ||
getMinHeight(beginRoot?: BTNKey | N | null | undefined, iterationType?: IterationType): number; | ||
getMinHeight(beginRoot?: BTNKey | N | null | undefined, iterationType?: IterationType | undefined): number; | ||
/** | ||
@@ -314,3 +315,3 @@ * Time Complexity: O(n) | ||
*/ | ||
getLeftMost(beginRoot?: BTNKey | N | null | undefined, iterationType?: IterationType): N | null | undefined; | ||
getLeftMost(beginRoot?: BTNKey | N | null | undefined, iterationType?: IterationType | undefined): N | null | undefined; | ||
/** | ||
@@ -335,3 +336,3 @@ * Time Complexity: O(log n) | ||
*/ | ||
getRightMost(beginRoot?: BTNKey | N | null | undefined, iterationType?: IterationType): N | null | undefined; | ||
getRightMost(beginRoot?: BTNKey | N | null | undefined, iterationType?: IterationType | undefined): N | null | undefined; | ||
/** | ||
@@ -353,3 +354,3 @@ * Time Complexity: O(n) | ||
*/ | ||
isSubtreeBST(beginRoot: BTNKey | N | null | undefined, iterationType?: IterationType): boolean; | ||
isSubtreeBST(beginRoot: BTNKey | N | null | undefined, iterationType?: IterationType | undefined): boolean; | ||
/** | ||
@@ -370,3 +371,3 @@ * Time Complexity: O(n) | ||
*/ | ||
isBST(iterationType?: IterationType): boolean; | ||
isBST(iterationType?: IterationType | undefined): boolean; | ||
subTreeTraverse<C extends BTNCallback<N>>(callback?: C, beginRoot?: BTNKey | N | null | undefined, iterationType?: IterationType, includeNull?: false): ReturnType<C>[]; | ||
@@ -441,2 +442,6 @@ subTreeTraverse<C extends BTNCallback<N>>(callback?: C, beginRoot?: BTNKey | N | null | undefined, iterationType?: IterationType, includeNull?: undefined): ReturnType<C>[]; | ||
morris<C extends BTNCallback<N>>(callback?: C, pattern?: DFSOrderPattern, beginRoot?: BTNKey | N | null | undefined): ReturnType<C>[]; | ||
forEach(callback: (entry: [BTNKey, V | undefined], tree: typeof this) => void): void; | ||
filter(predicate: (entry: [BTNKey, V | undefined], tree: typeof this) => boolean): TREE; | ||
map(callback: (entry: [BTNKey, V | undefined], tree: typeof this) => V): TREE; | ||
reduce<T>(callback: (accumulator: T, entry: [BTNKey, V | undefined], tree: typeof this) => T, initialValue: T): T; | ||
/** | ||
@@ -451,11 +456,12 @@ * The above function is an iterator for a binary tree that can be used to traverse the tree in | ||
*/ | ||
[Symbol.iterator](node?: N | null | undefined): Generator<BTNKey, void, undefined>; | ||
[Symbol.iterator](node?: N | null | undefined): Generator<[BTNKey, V | undefined], void, undefined>; | ||
/** | ||
* The `print` function is used to display a binary tree structure in a visually appealing way. | ||
* @param {N | null | undefined} beginRoot - The `root` parameter is of type `BTNKey | N | null | | ||
* @param {BTNKey | N | null | undefined} [beginRoot=this.root] - The `root` parameter is of type `BTNKey | N | null | | ||
* undefined`. It represents the root node of a binary tree. The root node can have one of the | ||
* following types: | ||
* @param {BinaryTreePrintOptions} [options={ isShowUndefined: false, isShowNull: false, isShowRedBlackNIL: false}] - Options object that controls printing behavior. You can specify whether to display undefined, null, or sentinel nodes. | ||
*/ | ||
print(beginRoot?: BTNKey | N | null | undefined): void; | ||
protected _displayAux(node: N | null | undefined): [string[], number, number, number]; | ||
print(beginRoot?: BTNKey | N | null | undefined, options?: BinaryTreePrintOptions): void; | ||
protected _displayAux(node: N | null | undefined, options: BinaryTreePrintOptions): NodeDisplayLayout; | ||
protected _defaultOneParamCallback: (node: N) => number; | ||
@@ -462,0 +468,0 @@ /** |
@@ -8,3 +8,3 @@ /** | ||
*/ | ||
import type { BSTComparator, BSTNodeNested, BSTOptions, BTNCallback, BTNKey } from '../../types'; | ||
import type { BSTNested, BSTNodeNested, BSTOptions, BTNCallback, BTNKey } from '../../types'; | ||
import { CP, IterationType } from '../../types'; | ||
@@ -37,3 +37,4 @@ import { BinaryTree, BinaryTreeNode } from './binary-tree'; | ||
} | ||
export declare class BST<V = any, N extends BSTNode<V, N> = BSTNode<V, BSTNodeNested<V>>> extends BinaryTree<V, N> implements IBinaryTree<V, N> { | ||
export declare class BST<V = any, N extends BSTNode<V, N> = BSTNode<V, BSTNodeNested<V>>, TREE extends BST<V, N, TREE> = BST<V, N, BSTNested<V, N>>> extends BinaryTree<V, N, TREE> implements IBinaryTree<V, N, TREE> { | ||
options: BSTOptions; | ||
/** | ||
@@ -59,2 +60,3 @@ * The constructor function initializes a binary search tree with an optional comparator function. | ||
createNode(key: BTNKey, value?: V): N; | ||
createTree(options?: BSTOptions): TREE; | ||
/** | ||
@@ -101,3 +103,3 @@ * Time Complexity: O(log n) - Average case for a balanced tree. In the worst case (unbalanced tree), it can be O(n). | ||
*/ | ||
addMany(keysOrNodes: (BTNKey | N | undefined)[], data?: (V | undefined)[], isBalanceAdd?: boolean, iterationType?: IterationType): (N | undefined)[]; | ||
addMany(keysOrNodes: (BTNKey | N | undefined)[], data?: (V | undefined)[], isBalanceAdd?: boolean, iterationType?: IterationType | undefined): (N | undefined)[]; | ||
/** | ||
@@ -122,3 +124,3 @@ * Time Complexity: O(log n) - Average case for a balanced tree. | ||
*/ | ||
lastKey(beginRoot?: BTNKey | N | undefined, iterationType?: IterationType): BTNKey; | ||
lastKey(beginRoot?: BTNKey | N | undefined, iterationType?: IterationType | undefined): BTNKey; | ||
/** | ||
@@ -180,3 +182,3 @@ * Time Complexity: O(log n) - Average case for a balanced tree. | ||
*/ | ||
getNodes<C extends BTNCallback<N>>(identifier: ReturnType<C> | undefined, callback?: C, onlyOne?: boolean, beginRoot?: BTNKey | N | undefined, iterationType?: IterationType): N[]; | ||
getNodes<C extends BTNCallback<N>>(identifier: ReturnType<C> | undefined, callback?: C, onlyOne?: boolean, beginRoot?: BTNKey | N | undefined, iterationType?: IterationType | undefined): N[]; | ||
/** | ||
@@ -207,3 +209,3 @@ * Time Complexity: O(log n) - Average case for a balanced tree. O(n) - Visiting each node once when identifier is not node's key. | ||
*/ | ||
lesserOrGreaterTraverse<C extends BTNCallback<N>>(callback?: C, lesserOrGreater?: CP, targetNode?: BTNKey | N | undefined, iterationType?: IterationType): ReturnType<C>[]; | ||
lesserOrGreaterTraverse<C extends BTNCallback<N>>(callback?: C, lesserOrGreater?: CP, targetNode?: BTNKey | N | undefined, iterationType?: IterationType | undefined): ReturnType<C>[]; | ||
/** | ||
@@ -233,3 +235,3 @@ * Balancing Adjustment: | ||
*/ | ||
perfectlyBalance(iterationType?: IterationType): boolean; | ||
perfectlyBalance(iterationType?: IterationType | undefined): boolean; | ||
/** | ||
@@ -248,4 +250,3 @@ * Time Complexity: O(n) - Visiting each node once. | ||
*/ | ||
isAVLBalanced(iterationType?: IterationType): boolean; | ||
protected _comparator: BSTComparator; | ||
isAVLBalanced(iterationType?: IterationType | undefined): boolean; | ||
protected _setRoot(v: N | undefined): void; | ||
@@ -252,0 +253,0 @@ /** |
@@ -56,10 +56,9 @@ "use strict"; | ||
super(options); | ||
this._comparator = (a, b) => a - b; | ||
if (options) { | ||
this.options = Object.assign({ iterationType: types_1.IterationType.ITERATIVE, comparator: (a, b) => a - b }, options); | ||
} | ||
else { | ||
this.options = { iterationType: types_1.IterationType.ITERATIVE, comparator: (a, b) => a - b }; | ||
} | ||
this._root = undefined; | ||
if (options !== undefined) { | ||
const { comparator } = options; | ||
if (comparator !== undefined) { | ||
this._comparator = comparator; | ||
} | ||
} | ||
} | ||
@@ -83,2 +82,5 @@ /** | ||
} | ||
createTree(options) { | ||
return new BST(Object.assign(Object.assign({}, this.options), options)); | ||
} | ||
/** | ||
@@ -201,3 +203,3 @@ * Time Complexity: O(log n) - Average case for a balanced tree. In the worst case (unbalanced tree), it can be O(n). | ||
*/ | ||
addMany(keysOrNodes, data, isBalanceAdd = true, iterationType = this.iterationType) { | ||
addMany(keysOrNodes, data, isBalanceAdd = true, iterationType = this.options.iterationType) { | ||
// TODO this addMany function is inefficient, it should be optimized | ||
@@ -290,3 +292,3 @@ function hasNoUndefined(arr) { | ||
*/ | ||
lastKey(beginRoot = this.root, iterationType = this.iterationType) { | ||
lastKey(beginRoot = this.root, iterationType = this.options.iterationType) { | ||
var _a, _b, _c, _d, _e, _f; | ||
@@ -388,3 +390,3 @@ if (this._compare(0, 1) === types_1.CP.lt) | ||
*/ | ||
getNodes(identifier, callback = this._defaultOneParamCallback, onlyOne = false, beginRoot = this.root, iterationType = this.iterationType) { | ||
getNodes(identifier, callback = this._defaultOneParamCallback, onlyOne = false, beginRoot = this.root, iterationType = this.options.iterationType) { | ||
beginRoot = this.ensureNotKey(beginRoot); | ||
@@ -470,3 +472,3 @@ if (!beginRoot) | ||
*/ | ||
lesserOrGreaterTraverse(callback = this._defaultOneParamCallback, lesserOrGreater = types_1.CP.lt, targetNode = this.root, iterationType = this.iterationType) { | ||
lesserOrGreaterTraverse(callback = this._defaultOneParamCallback, lesserOrGreater = types_1.CP.lt, targetNode = this.root, iterationType = this.options.iterationType) { | ||
targetNode = this.ensureNotKey(targetNode); | ||
@@ -535,3 +537,3 @@ const ans = []; | ||
*/ | ||
perfectlyBalance(iterationType = this.iterationType) { | ||
perfectlyBalance(iterationType = this.options.iterationType) { | ||
const sorted = this.dfs(node => node, 'in'), n = sorted.length; | ||
@@ -586,3 +588,3 @@ this.clear(); | ||
*/ | ||
isAVLBalanced(iterationType = this.iterationType) { | ||
isAVLBalanced(iterationType = this.options.iterationType) { | ||
var _a, _b; | ||
@@ -648,3 +650,3 @@ if (!this.root) | ||
_compare(a, b) { | ||
const compared = this._comparator(a, b); | ||
const compared = this.options.comparator(a, b); | ||
if (compared > 0) | ||
@@ -651,0 +653,0 @@ return types_1.CP.gt; |
@@ -8,3 +8,3 @@ /** | ||
*/ | ||
import { BiTreeDeleteResult, BTNCallback, BTNKey, IterationType, RBTNColor, RBTreeOptions, RedBlackTreeNodeNested } from '../../types'; | ||
import { BiTreeDeleteResult, BTNCallback, BTNKey, IterationType, RBTNColor, RBTreeOptions, RedBlackTreeNested, RedBlackTreeNodeNested } from '../../types'; | ||
import { BST, BSTNode } from './bst'; | ||
@@ -19,8 +19,9 @@ import { IBinaryTree } from '../../interfaces'; | ||
* 2. The root node is always black. | ||
* 3. Leaf nodes are typically NIL nodes and are considered black. | ||
* 3. Leaf nodes are typically Sentinel nodes and are considered black. | ||
* 4. Red nodes must have black children. | ||
* 5. Black balance: Every path from any node to each of its leaf nodes contains the same number of black nodes. | ||
*/ | ||
export declare class RedBlackTree<V = any, N extends RedBlackTreeNode<V, N> = RedBlackTreeNode<V, RedBlackTreeNodeNested<V>>> extends BST<V, N> implements IBinaryTree<V, N> { | ||
NIL: N; | ||
export declare class RedBlackTree<V = any, N extends RedBlackTreeNode<V, N> = RedBlackTreeNode<V, RedBlackTreeNodeNested<V>>, TREE extends RedBlackTree<V, N, TREE> = RedBlackTree<V, N, RedBlackTreeNested<V, N>>> extends BST<V, N, TREE> implements IBinaryTree<V, N, TREE> { | ||
Sentinel: N; | ||
options: RBTreeOptions; | ||
/** | ||
@@ -36,2 +37,4 @@ * The constructor function initializes a Red-Black Tree with an optional set of options. | ||
get size(): number; | ||
createNode(key: BTNKey, value?: V, color?: RBTNColor): N; | ||
createTree(options?: RBTreeOptions): TREE; | ||
/** | ||
@@ -53,3 +56,2 @@ * Time Complexity: O(log n) on average (where n is the number of nodes in the tree) | ||
add(keyOrNode: BTNKey | N | null | undefined, value?: V): N | undefined; | ||
createNode(key: BTNKey, value?: V, color?: RBTNColor): N; | ||
/** | ||
@@ -56,0 +58,0 @@ * Time Complexity: O(log n) on average (where n is the number of nodes in the tree) |
@@ -24,3 +24,3 @@ "use strict"; | ||
* 2. The root node is always black. | ||
* 3. Leaf nodes are typically NIL nodes and are considered black. | ||
* 3. Leaf nodes are typically Sentinel nodes and are considered black. | ||
* 4. Red nodes must have black children. | ||
@@ -37,5 +37,11 @@ * 5. Black balance: Every path from any node to each of its leaf nodes contains the same number of black nodes. | ||
super(options); | ||
this.NIL = new RedBlackTreeNode(NaN); | ||
this.Sentinel = new RedBlackTreeNode(NaN); | ||
this._size = 0; | ||
this._root = this.NIL; | ||
if (options) { | ||
this.options = Object.assign({ iterationType: types_1.IterationType.ITERATIVE, comparator: (a, b) => a - b }, options); | ||
} | ||
else { | ||
this.options = { iterationType: types_1.IterationType.ITERATIVE, comparator: (a, b) => a - b }; | ||
} | ||
this._root = this.Sentinel; | ||
} | ||
@@ -48,2 +54,8 @@ get root() { | ||
} | ||
createNode(key, value, color = types_1.RBTNColor.BLACK) { | ||
return new RedBlackTreeNode(key, value, color); | ||
} | ||
createTree(options) { | ||
return new RedBlackTree(Object.assign(Object.assign({}, this.options), options)); | ||
} | ||
/** | ||
@@ -81,7 +93,7 @@ * Time Complexity: O(log n) on average (where n is the number of nodes in the tree) | ||
} | ||
node.left = this.NIL; | ||
node.right = this.NIL; | ||
node.left = this.Sentinel; | ||
node.right = this.Sentinel; | ||
let y = undefined; | ||
let x = this.root; | ||
while (x !== this.NIL) { | ||
while (x !== this.Sentinel) { | ||
y = x; | ||
@@ -122,5 +134,2 @@ if (x) { | ||
} | ||
createNode(key, value, color = types_1.RBTNColor.BLACK) { | ||
return new RedBlackTreeNode(key, value, color); | ||
} | ||
/** | ||
@@ -150,5 +159,5 @@ * Time Complexity: O(log n) on average (where n is the number of nodes in the tree) | ||
const helper = (node) => { | ||
let z = this.NIL; | ||
let z = this.Sentinel; | ||
let x, y; | ||
while (node !== this.NIL) { | ||
while (node !== this.Sentinel) { | ||
if (node && callback(node) === identifier) { | ||
@@ -164,3 +173,3 @@ z = node; | ||
} | ||
if (z === this.NIL) { | ||
if (z === this.Sentinel) { | ||
this._size--; | ||
@@ -171,7 +180,7 @@ return; | ||
let yOriginalColor = y.color; | ||
if (z.left === this.NIL) { | ||
if (z.left === this.Sentinel) { | ||
x = z.right; | ||
this._rbTransplant(z, z.right); | ||
} | ||
else if (z.right === this.NIL) { | ||
else if (z.right === this.Sentinel) { | ||
x = z.left; | ||
@@ -207,3 +216,3 @@ this._rbTransplant(z, z.left); | ||
isRealNode(node) { | ||
return node !== this.NIL && node !== undefined; | ||
return node !== this.Sentinel && node !== undefined; | ||
} | ||
@@ -235,3 +244,3 @@ /** | ||
*/ | ||
getNode(identifier, callback = this._defaultOneParamCallback, beginRoot = this.root, iterationType = this.iterationType) { | ||
getNode(identifier, callback = this._defaultOneParamCallback, beginRoot = this.root, iterationType = this.options.iterationType) { | ||
var _a; | ||
@@ -257,7 +266,7 @@ if (identifier instanceof binary_tree_1.BinaryTreeNode) | ||
var _a; | ||
if (x.right !== this.NIL) { | ||
if (x.right !== this.Sentinel) { | ||
return (_a = this.getLeftMost(x.right)) !== null && _a !== void 0 ? _a : undefined; | ||
} | ||
let y = x.parent; | ||
while (y !== this.NIL && y !== undefined && x === y.right) { | ||
while (y !== this.Sentinel && y !== undefined && x === y.right) { | ||
x = y; | ||
@@ -282,7 +291,7 @@ y = y.parent; | ||
getPredecessor(x) { | ||
if (x.left !== this.NIL) { | ||
if (x.left !== this.Sentinel) { | ||
return this.getRightMost(x.left); | ||
} | ||
let y = x.parent; | ||
while (y !== this.NIL && x === y.left) { | ||
while (y !== this.Sentinel && x === y.left) { | ||
x = y; | ||
@@ -294,3 +303,3 @@ y = y.parent; | ||
clear() { | ||
this._root = this.NIL; | ||
this._root = this.Sentinel; | ||
this._size = 0; | ||
@@ -319,3 +328,3 @@ } | ||
x.right = y.left; | ||
if (y.left !== this.NIL) { | ||
if (y.left !== this.Sentinel) { | ||
if (y.left) | ||
@@ -354,3 +363,3 @@ y.left.parent = x; | ||
x.left = y.right; | ||
if (y.right !== this.NIL) { | ||
if (y.right !== this.Sentinel) { | ||
if (y.right) | ||
@@ -357,0 +366,0 @@ y.right.parent = x; |
@@ -9,3 +9,3 @@ /** | ||
import type { BTNKey, TreeMultimapNodeNested, TreeMultimapOptions } from '../../types'; | ||
import { BiTreeDeleteResult, BTNCallback, IterationType } from '../../types'; | ||
import { BiTreeDeleteResult, BTNCallback, IterationType, TreeMultimapNested } from '../../types'; | ||
import { IBinaryTree } from '../../interfaces'; | ||
@@ -30,3 +30,4 @@ import { AVLTree, AVLTreeNode } from './avl-tree'; | ||
*/ | ||
export declare class TreeMultimap<V = any, N extends TreeMultimapNode<V, N> = TreeMultimapNode<V, TreeMultimapNodeNested<V>>> extends AVLTree<V, N> implements IBinaryTree<V, N> { | ||
export declare class TreeMultimap<V = any, N extends TreeMultimapNode<V, N> = TreeMultimapNode<V, TreeMultimapNodeNested<V>>, TREE extends TreeMultimap<V, N, TREE> = TreeMultimap<V, N, TreeMultimapNested<V, N>>> extends AVLTree<V, N, TREE> implements IBinaryTree<V, N, TREE> { | ||
options: TreeMultimapOptions; | ||
/** | ||
@@ -51,2 +52,3 @@ * The constructor function for a TreeMultimap class in TypeScript, which extends another class and sets an option to | ||
createNode(key: BTNKey, value?: V, count?: number): N; | ||
createTree(options?: TreeMultimapOptions): TREE; | ||
/** | ||
@@ -104,3 +106,3 @@ * Time Complexity: O(log n) - logarithmic time, where "n" is the number of nodes in the tree. The add method of the superclass (AVLTree) has logarithmic time complexity. | ||
*/ | ||
perfectlyBalance(iterationType?: IterationType): boolean; | ||
perfectlyBalance(iterationType?: IterationType | undefined): boolean; | ||
/** | ||
@@ -107,0 +109,0 @@ * Time Complexity: O(n log n) - logarithmic time for each insertion, where "n" is the number of nodes in the tree. This is because the method calls the add method for each node. |
@@ -33,5 +33,11 @@ "use strict"; | ||
*/ | ||
constructor(options) { | ||
constructor(options = { iterationType: types_1.IterationType.ITERATIVE }) { | ||
super(options); | ||
this._count = 0; | ||
if (options) { | ||
this.options = Object.assign({ iterationType: types_1.IterationType.ITERATIVE, comparator: (a, b) => a - b }, options); | ||
} | ||
else { | ||
this.options = { iterationType: types_1.IterationType.ITERATIVE, comparator: (a, b) => a - b }; | ||
} | ||
} | ||
@@ -53,2 +59,5 @@ get count() { | ||
} | ||
createTree(options) { | ||
return new TreeMultimap(Object.assign(Object.assign({}, this.options), options)); | ||
} | ||
/** | ||
@@ -199,3 +208,3 @@ * Time Complexity: O(log n) - logarithmic time, where "n" is the number of nodes in the tree. The add method of the superclass (AVLTree) has logarithmic time complexity. | ||
*/ | ||
perfectlyBalance(iterationType = this.iterationType) { | ||
perfectlyBalance(iterationType = this.options.iterationType) { | ||
const sorted = this.dfs(node => node, 'in'), n = sorted.length; | ||
@@ -202,0 +211,0 @@ if (sorted.length < 1) |
@@ -1,4 +0,4 @@ | ||
import { BinaryTreeNode } from '../data-structures'; | ||
import { BinaryTreeNodeNested, BiTreeDeleteResult, BTNCallback, BTNKey } from '../types'; | ||
export interface IBinaryTree<V = any, N extends BinaryTreeNode<V, N> = BinaryTreeNodeNested<V>> { | ||
import { BinaryTree, BinaryTreeNode } from '../data-structures'; | ||
import { BinaryTreeNested, BinaryTreeNodeNested, BiTreeDeleteResult, BTNCallback, BTNKey } from '../types'; | ||
export interface IBinaryTree<V = any, N extends BinaryTreeNode<V, N> = BinaryTreeNodeNested<V>, TREE extends BinaryTree<V, N, TREE> = BinaryTreeNested<V, N>> { | ||
createNode(key: BTNKey, value?: N['value']): N; | ||
@@ -5,0 +5,0 @@ add(keyOrNode: BTNKey | N | null, value?: N['value']): N | null | undefined; |
@@ -9,6 +9,2 @@ export type Comparator<T> = (a: T, b: T) => number; | ||
} | ||
export declare const enum IterateDirection { | ||
DEFAULT = 0, | ||
REVERSE = 1 | ||
} | ||
export interface IterableWithSize<T> extends Iterable<T> { | ||
@@ -21,1 +17,6 @@ size: number | ((...args: any[]) => number); | ||
export type IterableWithSizeOrLength<T> = IterableWithSize<T> | IterableWithLength<T>; | ||
export type BinaryTreePrintOptions = { | ||
isShowUndefined?: boolean; | ||
isShowNull?: boolean; | ||
isShowRedBlackNIL?: boolean; | ||
}; |
@@ -1,4 +0,5 @@ | ||
import { AVLTreeNode } from '../../../data-structures'; | ||
import { AVLTree, AVLTreeNode } from '../../../data-structures'; | ||
import { BSTOptions } from './bst'; | ||
export type AVLTreeNodeNested<T> = AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>; | ||
export type AVLTreeNested<T, N extends AVLTreeNode<T, N>> = AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>; | ||
export type AVLTreeOptions = BSTOptions & {}; |
@@ -1,2 +0,2 @@ | ||
import { BinaryTreeNode } from '../../../data-structures'; | ||
import { BinaryTree, BinaryTreeNode } from '../../../data-structures'; | ||
/** | ||
@@ -27,4 +27,6 @@ * Enum representing different loop types. | ||
export type BinaryTreeNodeNested<T> = BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>; | ||
export type BinaryTreeNested<T, N extends BinaryTreeNode<T, N>> = BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>; | ||
export type BinaryTreeOptions = { | ||
iterationType?: IterationType; | ||
}; | ||
export type NodeDisplayLayout = [string[], number, number, number]; |
@@ -25,7 +25,1 @@ "use strict"; | ||
})(FamilyPosition || (exports.FamilyPosition = FamilyPosition = {})); | ||
// | ||
// export type BTNIdentifierOrNU<N> = BTNKey | N | null | undefined; | ||
// | ||
// export type BTNIdentifierOrU<N> = BTNKey | N | undefined; | ||
// | ||
// export type BTNOrNU<N> = N | null | undefined; |
@@ -1,7 +0,8 @@ | ||
import { BSTNode } from '../../../data-structures'; | ||
import { BST, BSTNode } from '../../../data-structures'; | ||
import type { BinaryTreeOptions, BTNKey } from './binary-tree'; | ||
export type BSTComparator = (a: BTNKey, b: BTNKey) => number; | ||
export type BSTNodeNested<T> = BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>; | ||
export type BSTNested<T, N extends BSTNode<T, N>> = BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>; | ||
export type BSTOptions = BinaryTreeOptions & { | ||
comparator?: BSTComparator; | ||
}; |
@@ -1,2 +0,2 @@ | ||
import { RedBlackTreeNode } from '../../../data-structures'; | ||
import { RedBlackTree, RedBlackTreeNode } from '../../../data-structures'; | ||
import { BSTOptions } from "./bst"; | ||
@@ -8,2 +8,3 @@ export declare enum RBTNColor { | ||
export type RedBlackTreeNodeNested<T> = RedBlackTreeNode<T, RedBlackTreeNode<T, RedBlackTreeNode<T, RedBlackTreeNode<T, RedBlackTreeNode<T, RedBlackTreeNode<T, RedBlackTreeNode<T, RedBlackTreeNode<T, RedBlackTreeNode<T, RedBlackTreeNode<T, RedBlackTreeNode<T, RedBlackTreeNode<T, RedBlackTreeNode<T, RedBlackTreeNode<T, RedBlackTreeNode<T, RedBlackTreeNode<T, RedBlackTreeNode<T, RedBlackTreeNode<T, RedBlackTreeNode<T, RedBlackTreeNode<T, RedBlackTreeNode<T, RedBlackTreeNode<T, RedBlackTreeNode<T, RedBlackTreeNode<T, RedBlackTreeNode<T, RedBlackTreeNode<T, RedBlackTreeNode<T, RedBlackTreeNode<T, RedBlackTreeNode<T, RedBlackTreeNode<T, RedBlackTreeNode<T, RedBlackTreeNode<T, RedBlackTreeNode<T, RedBlackTreeNode<T, RedBlackTreeNode<T, RedBlackTreeNode<T, RedBlackTreeNode<T, RedBlackTreeNode<T, RedBlackTreeNode<T, RedBlackTreeNode<T, RedBlackTreeNode<T, RedBlackTreeNode<T, RedBlackTreeNode<T, RedBlackTreeNode<T, RedBlackTreeNode<T, RedBlackTreeNode<T, RedBlackTreeNode<T, RedBlackTreeNode<T, RedBlackTreeNode<T, RedBlackTreeNode<T, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>; | ||
export type RedBlackTreeNested<T, N extends RedBlackTreeNode<T, N>> = RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>; | ||
export type RBTreeOptions = BSTOptions & {}; |
@@ -1,4 +0,5 @@ | ||
import { TreeMultimapNode } from '../../../data-structures'; | ||
import { TreeMultimap, TreeMultimapNode } from '../../../data-structures'; | ||
import { AVLTreeOptions } from './avl-tree'; | ||
export type TreeMultimapNodeNested<T> = TreeMultimapNode<T, TreeMultimapNode<T, TreeMultimapNode<T, TreeMultimapNode<T, TreeMultimapNode<T, TreeMultimapNode<T, TreeMultimapNode<T, TreeMultimapNode<T, TreeMultimapNode<T, TreeMultimapNode<T, TreeMultimapNode<T, TreeMultimapNode<T, TreeMultimapNode<T, TreeMultimapNode<T, TreeMultimapNode<T, TreeMultimapNode<T, TreeMultimapNode<T, TreeMultimapNode<T, TreeMultimapNode<T, TreeMultimapNode<T, TreeMultimapNode<T, TreeMultimapNode<T, TreeMultimapNode<T, TreeMultimapNode<T, TreeMultimapNode<T, TreeMultimapNode<T, TreeMultimapNode<T, TreeMultimapNode<T, TreeMultimapNode<T, TreeMultimapNode<T, TreeMultimapNode<T, TreeMultimapNode<T, TreeMultimapNode<T, TreeMultimapNode<T, TreeMultimapNode<T, TreeMultimapNode<T, TreeMultimapNode<T, TreeMultimapNode<T, TreeMultimapNode<T, TreeMultimapNode<T, TreeMultimapNode<T, TreeMultimapNode<T, TreeMultimapNode<T, TreeMultimapNode<T, TreeMultimapNode<T, TreeMultimapNode<T, TreeMultimapNode<T, TreeMultimapNode<T, TreeMultimapNode<T, TreeMultimapNode<T, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>; | ||
export type TreeMultimapNested<T, N extends TreeMultimapNode<T, N>> = TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>; | ||
export type TreeMultimapOptions = Omit<AVLTreeOptions, 'isMergeDuplicatedNodeByKey'> & {}; |
{ | ||
"name": "priority-queue-typed", | ||
"version": "1.46.8", | ||
"version": "1.46.9", | ||
"description": "Priority Queue, Min Priority Queue, Max Priority Queue. Javascript & Typescript Data Structure.", | ||
@@ -123,4 +123,4 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"data-structure-typed": "^1.46.7" | ||
"data-structure-typed": "^1.46.9" | ||
} | ||
} |
@@ -9,4 +9,4 @@ /** | ||
import { BST, BSTNode } from './bst'; | ||
import type { AVLTreeNodeNested, AVLTreeOptions, BiTreeDeleteResult, BTNKey } from '../../types'; | ||
import { BTNCallback } from '../../types'; | ||
import type { AVLTreeNested, AVLTreeNodeNested, AVLTreeOptions, BiTreeDeleteResult, BTNKey } from '../../types'; | ||
import { BTNCallback, IterationType } from '../../types'; | ||
import { IBinaryTree } from '../../interfaces'; | ||
@@ -23,5 +23,8 @@ | ||
export class AVLTree<V = any, N extends AVLTreeNode<V, N> = AVLTreeNode<V, AVLTreeNodeNested<V>>> | ||
extends BST<V, N> | ||
implements IBinaryTree<V, N> { | ||
export class AVLTree<V = any, N extends AVLTreeNode<V, N> = AVLTreeNode<V, AVLTreeNodeNested<V>>, TREE extends AVLTree<V, N, TREE> = AVLTree<V, N, AVLTreeNested<V, N>>> | ||
extends BST<V, N, TREE> | ||
implements IBinaryTree<V, N, TREE> { | ||
override options: AVLTreeOptions; | ||
/** | ||
@@ -35,2 +38,7 @@ * This is a constructor function for an AVL tree data structure in TypeScript. | ||
super(options); | ||
if (options) { | ||
this.options = { iterationType: IterationType.ITERATIVE, comparator: (a, b) => a - b, ...options } | ||
} else { | ||
this.options = { iterationType: IterationType.ITERATIVE, comparator: (a, b) => a - b }; | ||
} | ||
} | ||
@@ -51,2 +59,6 @@ | ||
override createTree(options?: AVLTreeOptions) { | ||
return new AVLTree<V, N, TREE>({ ...this.options, ...options }) as TREE; | ||
} | ||
/** | ||
@@ -53,0 +65,0 @@ * Time Complexity: O(log n) - logarithmic time, where "n" is the number of nodes in the tree. The add method of the superclass (BST) has logarithmic time complexity. |
@@ -8,3 +8,3 @@ /** | ||
*/ | ||
import type { BSTComparator, BSTNodeNested, BSTOptions, BTNCallback, BTNKey } from '../../types'; | ||
import type { BSTNested, BSTNodeNested, BSTOptions, BTNCallback, BTNKey } from '../../types'; | ||
import { CP, IterationType } from '../../types'; | ||
@@ -66,5 +66,8 @@ import { BinaryTree, BinaryTreeNode } from './binary-tree'; | ||
export class BST<V = any, N extends BSTNode<V, N> = BSTNode<V, BSTNodeNested<V>>> | ||
extends BinaryTree<V, N> | ||
implements IBinaryTree<V, N> { | ||
export class BST<V = any, N extends BSTNode<V, N> = BSTNode<V, BSTNodeNested<V>>, TREE extends BST<V, N, TREE> = BST<V, N, BSTNested<V, N>>> | ||
extends BinaryTree<V, N, TREE> | ||
implements IBinaryTree<V, N, TREE> { | ||
override options: BSTOptions; | ||
/** | ||
@@ -77,9 +80,8 @@ * The constructor function initializes a binary search tree with an optional comparator function. | ||
super(options); | ||
if (options) { | ||
this.options = { iterationType: IterationType.ITERATIVE, comparator: (a, b) => a - b, ...options } | ||
} else { | ||
this.options = { iterationType: IterationType.ITERATIVE, comparator: (a, b) => a - b }; | ||
} | ||
this._root = undefined; | ||
if (options !== undefined) { | ||
const { comparator } = options; | ||
if (comparator !== undefined) { | ||
this._comparator = comparator; | ||
} | ||
} | ||
} | ||
@@ -108,2 +110,6 @@ | ||
override createTree(options?: BSTOptions): TREE { | ||
return new BST<V, N, TREE>({ ...this.options, ...options }) as TREE; | ||
} | ||
/** | ||
@@ -222,3 +228,3 @@ * Time Complexity: O(log n) - Average case for a balanced tree. In the worst case (unbalanced tree), it can be O(n). | ||
isBalanceAdd = true, | ||
iterationType = this.iterationType | ||
iterationType = this.options.iterationType | ||
): (N | undefined)[] { | ||
@@ -318,3 +324,3 @@ // TODO this addMany function is inefficient, it should be optimized | ||
*/ | ||
lastKey(beginRoot: BTNKey | N | undefined = this.root, iterationType = this.iterationType): BTNKey { | ||
lastKey(beginRoot: BTNKey | N | undefined = this.root, iterationType = this.options.iterationType): BTNKey { | ||
if (this._compare(0, 1) === CP.lt) return this.getRightMost(beginRoot, iterationType)?.key ?? 0; | ||
@@ -415,3 +421,3 @@ else if (this._compare(0, 1) === CP.gt) return this.getLeftMost(beginRoot, iterationType)?.key ?? 0; | ||
beginRoot: BTNKey | N | undefined = this.root, | ||
iterationType = this.iterationType | ||
iterationType = this.options.iterationType | ||
): N[] { | ||
@@ -497,3 +503,3 @@ beginRoot = this.ensureNotKey(beginRoot); | ||
targetNode: BTNKey | N | undefined = this.root, | ||
iterationType = this.iterationType | ||
iterationType = this.options.iterationType | ||
): ReturnType<C>[] { | ||
@@ -561,3 +567,3 @@ targetNode = this.ensureNotKey(targetNode); | ||
*/ | ||
perfectlyBalance(iterationType = this.iterationType): boolean { | ||
perfectlyBalance(iterationType = this.options.iterationType): boolean { | ||
const sorted = this.dfs(node => node, 'in'), | ||
@@ -614,3 +620,3 @@ n = sorted.length; | ||
*/ | ||
isAVLBalanced(iterationType = this.iterationType): boolean { | ||
isAVLBalanced(iterationType = this.options.iterationType): boolean { | ||
if (!this.root) return true; | ||
@@ -659,4 +665,2 @@ | ||
protected _comparator: BSTComparator = (a, b) => a - b; | ||
protected _setRoot(v: N | undefined) { | ||
@@ -678,3 +682,3 @@ if (v) { | ||
protected _compare(a: BTNKey, b: BTNKey): CP { | ||
const compared = this._comparator(a, b); | ||
const compared = this.options.comparator!(a, b); | ||
if (compared > 0) return CP.gt; | ||
@@ -681,0 +685,0 @@ else if (compared < 0) return CP.lt; |
@@ -16,2 +16,3 @@ /** | ||
RBTreeOptions, | ||
RedBlackTreeNested, | ||
RedBlackTreeNodeNested | ||
@@ -38,10 +39,11 @@ } from '../../types'; | ||
* 2. The root node is always black. | ||
* 3. Leaf nodes are typically NIL nodes and are considered black. | ||
* 3. Leaf nodes are typically Sentinel nodes and are considered black. | ||
* 4. Red nodes must have black children. | ||
* 5. Black balance: Every path from any node to each of its leaf nodes contains the same number of black nodes. | ||
*/ | ||
export class RedBlackTree<V = any, N extends RedBlackTreeNode<V, N> = RedBlackTreeNode<V, RedBlackTreeNodeNested<V>>> | ||
extends BST<V, N> | ||
implements IBinaryTree<V, N> { | ||
NIL: N = new RedBlackTreeNode<V>(NaN) as unknown as N; | ||
export class RedBlackTree<V = any, N extends RedBlackTreeNode<V, N> = RedBlackTreeNode<V, RedBlackTreeNodeNested<V>>, TREE extends RedBlackTree<V, N, TREE> = RedBlackTree<V, N, RedBlackTreeNested<V, N>>> | ||
extends BST<V, N, TREE> | ||
implements IBinaryTree<V, N, TREE> { | ||
Sentinel: N = new RedBlackTreeNode<V>(NaN) as unknown as N; | ||
override options: RBTreeOptions; | ||
@@ -55,3 +57,8 @@ /** | ||
super(options); | ||
this._root = this.NIL; | ||
if (options) { | ||
this.options = { iterationType: IterationType.ITERATIVE, comparator: (a, b) => a - b, ...options } | ||
} else { | ||
this.options = { iterationType: IterationType.ITERATIVE, comparator: (a, b) => a - b }; | ||
} | ||
this._root = this.Sentinel; | ||
} | ||
@@ -71,2 +78,10 @@ | ||
override createNode(key: BTNKey, value?: V, color: RBTNColor = RBTNColor.BLACK): N { | ||
return new RedBlackTreeNode<V, N>(key, value, color) as N; | ||
} | ||
override createTree(options?: RBTreeOptions): TREE { | ||
return new RedBlackTree<V, N, TREE>({ ...this.options, ...options }) as TREE; | ||
} | ||
/** | ||
@@ -102,4 +117,4 @@ * Time Complexity: O(log n) on average (where n is the number of nodes in the tree) | ||
node.left = this.NIL; | ||
node.right = this.NIL; | ||
node.left = this.Sentinel; | ||
node.right = this.Sentinel; | ||
@@ -109,3 +124,3 @@ let y: N | undefined = undefined; | ||
while (x !== this.NIL) { | ||
while (x !== this.Sentinel) { | ||
y = x; | ||
@@ -148,6 +163,2 @@ if (x) { | ||
override createNode(key: BTNKey, value?: V, color: RBTNColor = RBTNColor.BLACK): N { | ||
return new RedBlackTreeNode<V, N>(key, value, color) as N; | ||
} | ||
/** | ||
@@ -180,5 +191,5 @@ * Time Complexity: O(log n) on average (where n is the number of nodes in the tree) | ||
const helper = (node: N | undefined): void => { | ||
let z: N = this.NIL; | ||
let z: N = this.Sentinel; | ||
let x: N | undefined, y: N; | ||
while (node !== this.NIL) { | ||
while (node !== this.Sentinel) { | ||
if (node && callback(node) === identifier) { | ||
@@ -195,3 +206,3 @@ z = node; | ||
if (z === this.NIL) { | ||
if (z === this.Sentinel) { | ||
this._size--; | ||
@@ -203,6 +214,6 @@ return; | ||
let yOriginalColor: number = y.color; | ||
if (z.left === this.NIL) { | ||
if (z.left === this.Sentinel) { | ||
x = z.right; | ||
this._rbTransplant(z, z.right!); | ||
} else if (z.right === this.NIL) { | ||
} else if (z.right === this.Sentinel) { | ||
x = z.left; | ||
@@ -238,3 +249,3 @@ this._rbTransplant(z, z.left!); | ||
override isRealNode(node: N | undefined): node is N { | ||
return node !== this.NIL && node !== undefined; | ||
return node !== this.Sentinel && node !== undefined; | ||
} | ||
@@ -293,3 +304,3 @@ | ||
beginRoot: BTNKey | N | undefined = this.root, | ||
iterationType = this.iterationType | ||
iterationType = this.options.iterationType | ||
): N | null | undefined { | ||
@@ -315,3 +326,3 @@ if ((identifier as any) instanceof BinaryTreeNode) callback = (node => node) as C; | ||
override getSuccessor(x: N): N | undefined { | ||
if (x.right !== this.NIL) { | ||
if (x.right !== this.Sentinel) { | ||
return this.getLeftMost(x.right) ?? undefined; | ||
@@ -321,3 +332,3 @@ } | ||
let y: N | undefined = x.parent; | ||
while (y !== this.NIL && y !== undefined && x === y.right) { | ||
while (y !== this.Sentinel && y !== undefined && x === y.right) { | ||
x = y; | ||
@@ -344,3 +355,3 @@ y = y.parent; | ||
override getPredecessor(x: N): N { | ||
if (x.left !== this.NIL) { | ||
if (x.left !== this.Sentinel) { | ||
return this.getRightMost(x.left!)!; | ||
@@ -350,3 +361,3 @@ } | ||
let y: N | undefined = x.parent; | ||
while (y !== this.NIL && x === y!.left) { | ||
while (y !== this.Sentinel && x === y!.left) { | ||
x = y!; | ||
@@ -360,3 +371,3 @@ y = y!.parent; | ||
override clear() { | ||
this._root = this.NIL; | ||
this._root = this.Sentinel; | ||
this._size = 0; | ||
@@ -388,3 +399,3 @@ } | ||
x.right = y.left; | ||
if (y.left !== this.NIL) { | ||
if (y.left !== this.Sentinel) { | ||
if (y.left) y.left.parent = x; | ||
@@ -422,3 +433,3 @@ } | ||
x.left = y.right; | ||
if (y.right !== this.NIL) { | ||
if (y.right !== this.Sentinel) { | ||
if (y.right) y.right.parent = x; | ||
@@ -425,0 +436,0 @@ } |
@@ -9,3 +9,3 @@ /** | ||
import type { BTNKey, TreeMultimapNodeNested, TreeMultimapOptions } from '../../types'; | ||
import { BiTreeDeleteResult, BTNCallback, CP, FamilyPosition, IterationType } from '../../types'; | ||
import { BiTreeDeleteResult, BTNCallback, CP, FamilyPosition, IterationType, TreeMultimapNested } from '../../types'; | ||
import { IBinaryTree } from '../../interfaces'; | ||
@@ -39,5 +39,9 @@ import { AVLTree, AVLTreeNode } from './avl-tree'; | ||
*/ | ||
export class TreeMultimap<V = any, N extends TreeMultimapNode<V, N> = TreeMultimapNode<V, TreeMultimapNodeNested<V>>> | ||
extends AVLTree<V, N> | ||
implements IBinaryTree<V, N> { | ||
export class TreeMultimap<V = any, N extends TreeMultimapNode<V, N> = TreeMultimapNode<V, TreeMultimapNodeNested<V>>, | ||
TREE extends TreeMultimap<V, N, TREE> = TreeMultimap<V, N, TreeMultimapNested<V, N>>> | ||
extends AVLTree<V, N, TREE> | ||
implements IBinaryTree<V, N, TREE> { | ||
override options: TreeMultimapOptions; | ||
/** | ||
@@ -49,4 +53,9 @@ * The constructor function for a TreeMultimap class in TypeScript, which extends another class and sets an option to | ||
*/ | ||
constructor(options?: TreeMultimapOptions) { | ||
constructor(options: TreeMultimapOptions = { iterationType: IterationType.ITERATIVE }) { | ||
super(options); | ||
if (options) { | ||
this.options = { iterationType: IterationType.ITERATIVE, comparator: (a, b) => a - b, ...options } | ||
} else { | ||
this.options = { iterationType: IterationType.ITERATIVE, comparator: (a, b) => a - b }; | ||
} | ||
} | ||
@@ -73,2 +82,6 @@ | ||
override createTree(options?: TreeMultimapOptions): TREE { | ||
return new TreeMultimap<V, N, TREE>({ ...this.options, ...options }) as TREE; | ||
} | ||
/** | ||
@@ -217,3 +230,3 @@ * Time Complexity: O(log n) - logarithmic time, where "n" is the number of nodes in the tree. The add method of the superclass (AVLTree) has logarithmic time complexity. | ||
*/ | ||
override perfectlyBalance(iterationType = this.iterationType): boolean { | ||
override perfectlyBalance(iterationType = this.options.iterationType): boolean { | ||
const sorted = this.dfs(node => node, 'in'), | ||
@@ -220,0 +233,0 @@ n = sorted.length; |
@@ -1,5 +0,5 @@ | ||
import { BinaryTreeNode } from '../data-structures'; | ||
import { BinaryTreeNodeNested, BiTreeDeleteResult, BTNCallback, BTNKey } from '../types'; | ||
import { BinaryTree, BinaryTreeNode } from '../data-structures'; | ||
import { BinaryTreeNested, BinaryTreeNodeNested, BiTreeDeleteResult, BTNCallback, BTNKey } from '../types'; | ||
export interface IBinaryTree<V = any, N extends BinaryTreeNode<V, N> = BinaryTreeNodeNested<V>> { | ||
export interface IBinaryTree<V = any, N extends BinaryTreeNode<V, N> = BinaryTreeNodeNested<V>, TREE extends BinaryTree<V, N, TREE> = BinaryTreeNested<V, N>> { | ||
createNode(key: BTNKey, value?: N['value']): N; | ||
@@ -6,0 +6,0 @@ |
@@ -13,7 +13,2 @@ export type Comparator<T> = (a: T, b: T) => number; | ||
export const enum IterateDirection { | ||
DEFAULT = 0, | ||
REVERSE = 1 | ||
} | ||
export interface IterableWithSize<T> extends Iterable<T> { | ||
@@ -28,1 +23,3 @@ size: number | ((...args: any[]) => number); | ||
export type IterableWithSizeOrLength<T> = IterableWithSize<T> | IterableWithLength<T> | ||
export type BinaryTreePrintOptions = { isShowUndefined?: boolean, isShowNull?: boolean, isShowRedBlackNIL?: boolean } |
@@ -1,5 +0,9 @@ | ||
import { AVLTreeNode } from '../../../data-structures'; | ||
import { AVLTree, AVLTreeNode } from '../../../data-structures'; | ||
import { BSTOptions } from './bst'; | ||
export type AVLTreeNodeNested<T> = AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> | ||
export type AVLTreeNested<T, N extends AVLTreeNode<T, N>> = AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, AVLTree<T, N, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> | ||
export type AVLTreeOptions = BSTOptions & {}; |
@@ -1,2 +0,2 @@ | ||
import { BinaryTreeNode } from '../../../data-structures'; | ||
import { BinaryTree, BinaryTreeNode } from '../../../data-structures'; | ||
@@ -31,8 +31,6 @@ /** | ||
export type BinaryTreeNested<T, N extends BinaryTreeNode<T, N>> = BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, BinaryTree<T, N, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> | ||
export type BinaryTreeOptions = { iterationType?: IterationType } | ||
// | ||
// export type BTNIdentifierOrNU<N> = BTNKey | N | null | undefined; | ||
// | ||
// export type BTNIdentifierOrU<N> = BTNKey | N | undefined; | ||
// | ||
// export type BTNOrNU<N> = N | null | undefined; | ||
export type NodeDisplayLayout = [string[], number, number, number]; |
@@ -1,2 +0,2 @@ | ||
import { BSTNode } from '../../../data-structures'; | ||
import { BST, BSTNode } from '../../../data-structures'; | ||
import type { BinaryTreeOptions, BTNKey } from './binary-tree'; | ||
@@ -9,4 +9,6 @@ | ||
export type BSTNested<T, N extends BSTNode<T, N>> = BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, BST<T, N, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> | ||
export type BSTOptions = BinaryTreeOptions & { | ||
comparator?: BSTComparator, | ||
} |
@@ -1,2 +0,2 @@ | ||
import { RedBlackTreeNode } from '../../../data-structures'; | ||
import { RedBlackTree, RedBlackTreeNode } from '../../../data-structures'; | ||
import { BSTOptions } from "./bst"; | ||
@@ -8,2 +8,4 @@ | ||
export type RedBlackTreeNested<T, N extends RedBlackTreeNode<T, N>> = RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, RedBlackTree<T, N, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> | ||
export type RBTreeOptions = BSTOptions & {}; |
@@ -1,2 +0,2 @@ | ||
import { TreeMultimapNode } from '../../../data-structures'; | ||
import { TreeMultimap, TreeMultimapNode } from '../../../data-structures'; | ||
import { AVLTreeOptions } from './avl-tree'; | ||
@@ -6,2 +6,4 @@ | ||
export type TreeMultimapNested<T, N extends TreeMultimapNode<T, N>> = TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, TreeMultimap<T, N, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> | ||
export type TreeMultimapOptions = Omit<AVLTreeOptions, 'isMergeDuplicatedNodeByKey'> & {} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1847080
33284
Updateddata-structure-typed@^1.46.9