Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tree-multiset-typed

Package Overview
Dependencies
Maintainers
1
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tree-multiset-typed - npm Package Compare versions

Comparing version 1.42.2 to 1.42.3

2

dist/data-structures/binary-tree/binary-tree.d.ts

@@ -82,3 +82,2 @@ /**

get size(): number;
protected defaultOneParamCallback: (node: N) => number;
/**

@@ -293,2 +292,3 @@ * Creates a new instance of BinaryTreeNode with the given key and value.

[Symbol.iterator](node?: N | null): Generator<BTNKey, void, undefined>;
protected defaultOneParamCallback: (node: N) => number;
/**

@@ -295,0 +295,0 @@ * Swap the data of two nodes in the binary tree.

@@ -1037,3 +1037,2 @@ "use strict";

}
// --- start additional methods ---
/**

@@ -1137,2 +1136,3 @@ * The `morris` function performs a depth-first traversal of a binary tree using the Morris traversal

}
// --- start additional methods ---
/**

@@ -1139,0 +1139,0 @@ * The above function is an iterator for a binary tree that can be used to traverse the tree in

{
"name": "tree-multiset-typed",
"version": "1.42.2",
"version": "1.42.3",
"description": "Tree Multiset, AVLTree, BST, Binary Tree. Javascript & Typescript Data Structure.",

@@ -182,4 +182,4 @@ "main": "dist/index.js",

"dependencies": {
"data-structure-typed": "^1.42.2"
"data-structure-typed": "^1.42.3"
}
}

@@ -111,3 +111,4 @@ /**

export class BinaryTree<V = any, N extends BinaryTreeNode<V, N> = BinaryTreeNode<V, BinaryTreeNodeNested<V>>>
implements IBinaryTree<V, N> {
implements IBinaryTree<V, N>
{
iterationType: IterationType = IterationType.ITERATIVE;

@@ -144,4 +145,2 @@

protected defaultOneParamCallback = (node: N) => node.key;
/**

@@ -395,3 +394,3 @@ * Creates a new instance of BinaryTreeNode with the given key and value.

const stack: { node: N; depth: number }[] = [{node: beginRoot, depth: 0}];
const stack: {node: N; depth: number}[] = [{node: beginRoot, depth: 0}];
let maxHeight = 0;

@@ -856,3 +855,3 @@

includeNull?: false
): ReturnType<C>[]
): ReturnType<C>[];

@@ -864,3 +863,3 @@ subTreeTraverse<C extends BTNCallback<N>>(

includeNull?: undefined
): ReturnType<C>[]
): ReturnType<C>[];

@@ -872,3 +871,3 @@ subTreeTraverse<C extends BTNCallback<N | null>>(

includeNull?: true
): ReturnType<C>[]
): ReturnType<C>[];

@@ -917,3 +916,3 @@ /**

} else {
const stack: (N| null)[] = [beginRoot];
const stack: (N | null)[] = [beginRoot];

@@ -943,3 +942,3 @@ while (stack.length > 0) {

includeNull?: false
): ReturnType<C>[]
): ReturnType<C>[];

@@ -952,3 +951,3 @@ dfs<C extends BTNCallback<N>>(

includeNull?: undefined
): ReturnType<C>[]
): ReturnType<C>[];

@@ -961,3 +960,3 @@ dfs<C extends BTNCallback<N | null>>(

includeNull?: true
): ReturnType<C>[]
): ReturnType<C>[];

@@ -1032,3 +1031,3 @@ /**

// 0: visit, 1: print
const stack: { opt: 0 | 1; node: N | null | undefined }[] = [{opt: 0, node: beginRoot}];
const stack: {opt: 0 | 1; node: N | null | undefined}[] = [{opt: 0, node: beginRoot}];

@@ -1080,3 +1079,3 @@ while (stack.length > 0) {

includeNull?: false
): ReturnType<C>[]
): ReturnType<C>[];

@@ -1088,3 +1087,3 @@ bfs<C extends BTNCallback<N>>(

includeNull?: undefined
): ReturnType<C>[]
): ReturnType<C>[];

@@ -1096,3 +1095,3 @@ bfs<C extends BTNCallback<N | null>>(

includeNull?: true
): ReturnType<C>[]
): ReturnType<C>[];

@@ -1140,3 +1139,2 @@ /**

traverse(level + 1);

@@ -1162,3 +1160,2 @@ };

}
}

@@ -1171,21 +1168,21 @@ }

listLevels<C extends BTNCallback<N>>(
callback?: C ,
beginRoot?: N | null ,
callback?: C,
beginRoot?: N | null,
iterationType?: IterationType,
includeNull?: false
): ReturnType<C>[][]
): ReturnType<C>[][];
listLevels<C extends BTNCallback<N>>(
callback?: C ,
beginRoot?: N | null ,
callback?: C,
beginRoot?: N | null,
iterationType?: IterationType,
includeNull?: undefined
): ReturnType<C>[][]
): ReturnType<C>[][];
listLevels<C extends BTNCallback<N | null>>(
callback?: C ,
beginRoot?: N | null ,
callback?: C,
beginRoot?: N | null,
iterationType?: IterationType,
includeNull?: true
): ReturnType<C>[][]
): ReturnType<C>[][];

@@ -1224,3 +1221,3 @@ /**

if (node && node.right !== undefined) _recursive(node.right, level + 1);
} else {
} else {
if (node && node.left) _recursive(node.left, level + 1);

@@ -1245,3 +1242,3 @@ if (node && node.right) _recursive(node.right, level + 1);

if (node && node.left !== undefined) stack.push([node.left, level + 1]);
} else {
} else {
if (node && node.right) stack.push([node.right, level + 1]);

@@ -1295,4 +1292,2 @@ if (node && node.left) stack.push([node.left, level + 1]);

// --- start additional methods ---
/**

@@ -1397,2 +1392,4 @@ * The `morris` function performs a depth-first traversal of a binary tree using the Morris traversal

// --- start additional methods ---
/**

@@ -1407,3 +1404,3 @@ * The above function is an iterator for a binary tree that can be used to traverse the tree in

*/
* [Symbol.iterator](node = this.root): Generator<BTNKey, void, undefined> {
*[Symbol.iterator](node = this.root): Generator<BTNKey, void, undefined> {
if (!node) {

@@ -1441,2 +1438,4 @@ return;

protected defaultOneParamCallback = (node: N) => node.key;
/**

@@ -1443,0 +1442,0 @@ * Swap the data of two nodes in the binary tree.

@@ -67,3 +67,4 @@ /**

EO extends AbstractEdge<E> = AbstractEdge<E>
> implements IGraph<V, E, VO, EO> {
> implements IGraph<V, E, VO, EO>
{
protected _vertices: Map<VertexKey, VO> = new Map<VertexKey, VO>();

@@ -238,3 +239,3 @@

const stack: { vertex: VO, path: VO[] }[] = [];
const stack: {vertex: VO; path: VO[]}[] = [];
stack.push({vertex: vertex1, path: [vertex1]});

@@ -261,3 +262,2 @@

/**

@@ -372,3 +372,2 @@ * The function calculates the sum of weights along a given path.

}
} else {

@@ -526,10 +525,10 @@ // DFS

getMinDist &&
distMap.forEach((d, v) => {
if (v !== srcVertex) {
if (d < minDist) {
minDist = d;
if (genPaths) minDest = v;
distMap.forEach((d, v) => {
if (v !== srcVertex) {
if (d < minDist) {
minDist = d;
if (genPaths) minDest = v;
}
}
}
});
});

@@ -596,3 +595,3 @@ genPaths && getPaths(minDest);

const heap = new PriorityQueue<{ key: number; value: VO }>({comparator: (a, b) => a.key - b.key});
const heap = new PriorityQueue<{key: number; value: VO}>({comparator: (a, b) => a.key - b.key});
heap.add({key: 0, value: srcVertex});

@@ -821,3 +820,3 @@

*/
floydWarshall(): { costs: number[][]; predecessor: (VO | null)[][] } {
floydWarshall(): {costs: number[][]; predecessor: (VO | null)[][]} {
const idAndVertices = [...this._vertices];

@@ -886,3 +885,8 @@ const n = idAndVertices.length;

*/
tarjan(needCutVertexes: boolean = false, needBridges: boolean = false, needSCCs: boolean = true, needCycles: boolean = false) {
tarjan(
needCutVertexes: boolean = false,
needBridges: boolean = false,
needSCCs: boolean = true,
needCycles: boolean = false
) {
// !! in undirected graph we will not let child visit parent when dfs

@@ -889,0 +893,0 @@ // !! articulation point(in dfs search tree not in graph): (cur !== root && cur.has(child)) && (low(child) >= dfn(cur)) || (cur === root && cur.children() >= 2)

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc