Socket
Socket
Sign inDemoInstall

data-structure-typed

Package Overview
Dependencies
Maintainers
1
Versions
201
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

data-structure-typed - npm Package Compare versions

Comparing version 1.34.9 to 1.35.0

.github/ISSUE_TEMPLATE/bug_report.md

79

lib/interfaces/abstract-binary-tree.d.ts

@@ -1,84 +0,7 @@

import { AbstractBinaryTreeNodeProperties, AbstractBinaryTreeNodeProperty, BinaryTreeDeletedResult, BinaryTreeNodeKey, BinaryTreeNodePropertyName, DFSOrderPattern, FamilyPosition, LoopType, NodeOrPropertyName } from '../types';
import { BinaryTreeNodeKey } from '../types';
import { AbstractBinaryTreeNode } from '../data-structures';
export interface IAbstractBinaryTreeNode<T, NEIGHBOR extends IAbstractBinaryTreeNode<T, NEIGHBOR>> {
key: BinaryTreeNodeKey;
val: T | undefined;
get left(): NEIGHBOR | null | undefined;
set left(v: NEIGHBOR | null | undefined);
get right(): NEIGHBOR | null | undefined;
set right(v: NEIGHBOR | null | undefined);
parent: NEIGHBOR | null | undefined;
get familyPosition(): FamilyPosition;
}
export interface IAbstractBinaryTree<N extends AbstractBinaryTreeNode<N['val'], N>> {
createNode(key: BinaryTreeNodeKey, val?: N['val'], count?: number): N | null;
get loopType(): LoopType;
get visitedKey(): BinaryTreeNodeKey[];
get visitedVal(): Array<N['val']>;
get visitedNode(): N[];
get root(): N | null;
get size(): number;
swapLocation(srcNode: N, destNode: N): N;
clear(): void;
isEmpty(): boolean;
add(key: BinaryTreeNodeKey | N, val?: N['val']): N | null | undefined;
addMany(keysOrNodes: (BinaryTreeNodeKey | N | null)[], data?: N['val'][]): (N | null | undefined)[];
refill(keysOrNodes: (BinaryTreeNodeKey | N | null)[], data?: N[] | Array<N['val']>): boolean;
remove(key: BinaryTreeNodeKey, ignoreCount?: boolean): BinaryTreeDeletedResult<N>[];
getDepth(node: N): number;
getHeight(beginRoot?: N | null): number;
getMinHeight(beginRoot?: N | null): number;
isPerfectlyBalanced(beginRoot?: N | null): boolean;
getNodes(nodeProperty: BinaryTreeNodeKey | N, propertyName?: BinaryTreeNodePropertyName, onlyOne?: boolean): N[];
has(nodeProperty: BinaryTreeNodeKey | N, propertyName?: BinaryTreeNodePropertyName): boolean;
get(nodeProperty: BinaryTreeNodeKey | N, propertyName?: BinaryTreeNodePropertyName): N | null;
getPathToRoot(node: N): N[];
getLeftMost(): N | null;
getLeftMost(node: N): N;
getLeftMost(node?: N | null): N | null;
getRightMost(): N | null;
getRightMost(node: N): N;
getRightMost(node?: N | null): N | null;
isSubtreeBST(node: N | null): boolean;
isBST(): boolean;
getSubTreeSize(subTreeRoot: N | null | undefined): number;
subTreeSum(subTreeRoot: N, propertyName?: BinaryTreeNodePropertyName): number;
subTreeAdd(subTreeRoot: N, delta: number, propertyName?: BinaryTreeNodePropertyName): boolean;
bfs(): BinaryTreeNodeKey[];
bfs(nodeOrPropertyName: 'key'): BinaryTreeNodeKey[];
bfs(nodeOrPropertyName: 'val'): N['val'][];
bfs(nodeOrPropertyName: 'node'): N[];
bfs(nodeOrPropertyName: 'count'): number[];
bfs(nodeOrPropertyName?: NodeOrPropertyName): AbstractBinaryTreeNodeProperties<N>;
dfs(): BinaryTreeNodeKey[];
dfs(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'key'): BinaryTreeNodeKey[];
dfs(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'val'): N[];
dfs(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'node'): N[];
dfs(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'count'): number[];
dfs(pattern?: 'in' | 'pre' | 'post', nodeOrPropertyName?: NodeOrPropertyName): AbstractBinaryTreeNodeProperties<N>;
dfsIterative(): BinaryTreeNodeKey[];
dfsIterative(pattern: DFSOrderPattern): BinaryTreeNodeKey[];
dfsIterative(pattern: DFSOrderPattern, nodeOrPropertyName: 'key'): BinaryTreeNodeKey[];
dfsIterative(pattern: DFSOrderPattern, nodeOrPropertyName: 'val'): N['val'][];
dfsIterative(pattern: DFSOrderPattern, nodeOrPropertyName: 'node'): N[];
dfsIterative(pattern?: DFSOrderPattern, nodeOrPropertyName?: NodeOrPropertyName): AbstractBinaryTreeNodeProperties<N>;
levelIterative(node: N | null): BinaryTreeNodeKey[];
levelIterative(node: N | null, nodeOrPropertyName?: 'key'): BinaryTreeNodeKey[];
levelIterative(node: N | null, nodeOrPropertyName?: 'val'): N['val'][];
levelIterative(node: N | null, nodeOrPropertyName?: 'node'): N[];
levelIterative(node: N | null, nodeOrPropertyName?: 'count'): number[];
levelIterative(node: N | null, nodeOrPropertyName?: NodeOrPropertyName): AbstractBinaryTreeNodeProperties<N>;
listLevels(node: N | null): BinaryTreeNodeKey[][];
listLevels(node: N | null, nodeOrPropertyName?: 'key'): BinaryTreeNodeKey[][];
listLevels(node: N | null, nodeOrPropertyName?: 'val'): N['val'][][];
listLevels(node: N | null, nodeOrPropertyName?: 'node'): N[][];
listLevels(node: N | null, nodeOrPropertyName?: 'count'): number[][];
listLevels(node: N | null, nodeOrPropertyName?: NodeOrPropertyName): AbstractBinaryTreeNodeProperty<N>[][];
getPredecessor(node: N): N;
morris(): BinaryTreeNodeKey[];
morris(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'key'): BinaryTreeNodeKey[];
morris(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'val'): N[];
morris(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'node'): N[];
morris(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'count'): number[];
morris(pattern?: 'in' | 'pre' | 'post', nodeOrPropertyName?: NodeOrPropertyName): AbstractBinaryTreeNodeProperties<N>;
}
import { VertexKey } from '../types';
export interface IAbstractGraph<V, E> {
hasVertex(vertexOrKey: V | VertexKey): boolean;
addVertex(key: VertexKey, val?: V): boolean;
removeVertex(vertexOrKey: V | VertexKey): boolean;
removeAllVertices(vertices: V[] | VertexKey[]): boolean;
degreeOf(vertexOrKey: V | VertexKey): number;
edgesOf(vertexOrKey: V | VertexKey): E[];
hasEdge(src: V | VertexKey, dest: V | VertexKey): boolean;
getEdge(srcOrKey: V | VertexKey, destOrKey: V | VertexKey): E | null;
edgeSet(): E[];
addEdge(src: V | VertexKey, dest: V | VertexKey, weight: number, val: E): boolean;
removeEdge(edge: E): E | null;
setEdgeWeight(srcOrKey: V | VertexKey, destOrKey: V | VertexKey, weight: number): boolean;
getMinPathBetween(v1: V | VertexKey, v2: V | VertexKey, isWeight?: boolean): V[] | null;
getNeighbors(vertexOrKey: V | VertexKey): V[];
createVertex(key: VertexKey, val?: V): V;
createEdge(srcOrV1: VertexKey | string, destOrV2: VertexKey | string, weight?: number, val?: E): E;
}
import { AVLTreeNode } from '../data-structures';
import { IBST, IBSTNode } from './bst';
import { BinaryTreeDeletedResult, BinaryTreeNodeKey } from '../types';
export interface IAVLTreeNode<T, NEIGHBOR extends IAVLTreeNode<T, NEIGHBOR>> extends IBSTNode<T, NEIGHBOR> {

@@ -8,4 +7,2 @@ height: number;

export interface IAVLTree<N extends AVLTreeNode<N['val'], N>> extends IBST<N> {
add(key: BinaryTreeNodeKey, val?: N['val'] | null): N | null | undefined;
remove(key: BinaryTreeNodeKey): BinaryTreeDeletedResult<N>[];
}
import { BinaryTreeNode } from '../data-structures';
import { IAbstractBinaryTree, IAbstractBinaryTreeNode } from './abstract-binary-tree';
export type IBinaryTreeNode<T, NEIGHBOR extends IBinaryTreeNode<T, NEIGHBOR>> = IAbstractBinaryTreeNode<T, NEIGHBOR>;
export type IBinaryTree<N extends BinaryTreeNode<N['val'], N>> = IAbstractBinaryTree<N>;
export interface IBinaryTreeNode<T, NEIGHBOR extends IBinaryTreeNode<T, NEIGHBOR>> extends IAbstractBinaryTreeNode<T, NEIGHBOR> {
}
export interface IBinaryTree<N extends BinaryTreeNode<N['val'], N>> extends IAbstractBinaryTree<N> {
}
import { BSTNode } from '../data-structures';
import { IBinaryTree, IBinaryTreeNode } from './binary-tree';
import { BinaryTreeDeletedResult, BinaryTreeNodeKey, BinaryTreeNodePropertyName } from '../types';
export interface IBSTNode<T, NEIGHBOR extends IBSTNode<T, NEIGHBOR>> extends IBinaryTreeNode<T, NEIGHBOR> {
}
export interface IBST<N extends BSTNode<N['val'], N>> extends IBinaryTree<N> {
createNode(key: BinaryTreeNodeKey, val?: N['val'], count?: number): N;
add(key: BinaryTreeNodeKey, val?: N['val'] | null, count?: number): N | null | undefined;
get(nodeProperty: BinaryTreeNodeKey | N, propertyName?: BinaryTreeNodePropertyName): N | null;
lastKey(): BinaryTreeNodeKey;
remove(key: BinaryTreeNodeKey, ignoreCount?: boolean): BinaryTreeDeletedResult<N>[];
getNodes(nodeProperty: BinaryTreeNodeKey | N, propertyName?: BinaryTreeNodePropertyName, onlyOne?: boolean): N[];
lesserSum(key: BinaryTreeNodeKey, propertyName?: BinaryTreeNodePropertyName): number;
allGreaterNodesAdd(node: N, delta: number, propertyName?: BinaryTreeNodePropertyName): boolean;
perfectlyBalance(): boolean;
isAVLBalanced(): boolean;
}

@@ -1,12 +0,3 @@

import { VertexKey } from '../types';
import { IAbstractGraph } from './abstract-graph';
export interface IDirectedGraph<V, E> extends IAbstractGraph<V, E> {
incomingEdgesOf(vertex: V): E[];
outgoingEdgesOf(vertex: V): E[];
inDegreeOf(vertexOrKey: V | VertexKey): number;
outDegreeOf(vertexOrKey: V | VertexKey): number;
getEdgeSrc(e: E): V | null;
getEdgeDest(e: E): V | null;
removeEdgeSrcToDest(srcOrKey: V | VertexKey, destOrKey: V | VertexKey): E | null;
removeEdgesBetween(v1: V | VertexKey, v2: V | VertexKey): E[];
}
import { RBTreeNode } from '../data-structures';
import { IBST, IBSTNode } from './bst';
import { BinaryTreeNodeKey } from '../types';
export type IRBTreeNode<T, NEIGHBOR extends IRBTreeNode<T, NEIGHBOR>> = IBSTNode<T, NEIGHBOR>;
export interface IRBTreeNode<T, NEIGHBOR extends IRBTreeNode<T, NEIGHBOR>> extends IBSTNode<T, NEIGHBOR> {
}
export interface IRBTree<N extends RBTreeNode<N['val'], N>> extends IBST<N> {
createNode(key: BinaryTreeNodeKey, val?: N['val'], count?: number): N;
}
import { TreeMultisetNode } from '../data-structures';
import { IBSTNode } from './bst';
import { IAVLTree } from './avl-tree';
export type ITreeMultisetNode<T, NEIGHBOR extends ITreeMultisetNode<T, NEIGHBOR>> = IBSTNode<T, NEIGHBOR>;
export type ITreeMultiset<N extends TreeMultisetNode<N['val'], N>> = IAVLTree<N>;
import { IAVLTree, IAVLTreeNode } from './avl-tree';
export interface ITreeMultisetNode<T, NEIGHBOR extends ITreeMultisetNode<T, NEIGHBOR>> extends IAVLTreeNode<T, NEIGHBOR> {
}
export interface ITreeMultiset<N extends TreeMultisetNode<N['val'], N>> extends IAVLTree<N> {
}

@@ -1,5 +0,3 @@

import { VertexKey } from '../types';
import { IAbstractGraph } from './abstract-graph';
export interface IUNDirectedGraph<V, E> extends IAbstractGraph<V, E> {
removeEdgeBetween(v1: V | VertexKey, v2: V | VertexKey): E | null;
}
{
"name": "data-structure-typed",
"version": "1.34.9",
"version": "1.35.0",
"description": "Data Structures of Javascript & TypeScript. Binary Tree, BST, Graph, Heap, Priority Queue, Linked List, Queue, Deque, Stack, AVL Tree, Tree Multiset, Trie, Directed Graph, Undirected Graph, Singly Linked List, Doubly Linked List, Max Heap, Max Priority Queue, Min Heap, Min Priority Queue.",

@@ -25,3 +25,3 @@ "main": "dist/index.js",

"fix": "npm run fix:src && npm run fix:test",
"update:test-deps": "npm i avl-tree-typed binary-tree-typed bst-typed heap-typed --save-dev",
"update:individuals": "npm i avl-tree-typed binary-tree-typed bst-typed heap-typed --save-dev",
"install:individuals": "npm i avl-tree-typed binary-tree-typed bst-typed deque-typed directed-graph-typed doubly-linked-list-typed graph-typed heap-typed linked-list-typed max-heap-typed max-priority-queue-typed min-heap-typed min-priority-queue-typed priority-queue-typed singly-linked-list-typed stack-typed tree-multiset-typed trie-typed undirected-graph-typed queue-typed --save-dev",

@@ -28,0 +28,0 @@ "test": "jest",

@@ -1,176 +0,8 @@

import {
AbstractBinaryTreeNodeProperties,
AbstractBinaryTreeNodeProperty,
BinaryTreeDeletedResult,
BinaryTreeNodeKey,
BinaryTreeNodePropertyName,
DFSOrderPattern,
FamilyPosition,
LoopType,
NodeOrPropertyName
} from '../types';
import {BinaryTreeNodeKey} from '../types';
import {AbstractBinaryTreeNode} from '../data-structures';
export interface IAbstractBinaryTreeNode<T, NEIGHBOR extends IAbstractBinaryTreeNode<T, NEIGHBOR>> {
key: BinaryTreeNodeKey;
export interface IAbstractBinaryTreeNode<T, NEIGHBOR extends IAbstractBinaryTreeNode<T, NEIGHBOR>> {}
val: T | undefined;
get left(): NEIGHBOR | null | undefined;
set left(v: NEIGHBOR | null | undefined);
get right(): NEIGHBOR | null | undefined;
set right(v: NEIGHBOR | null | undefined);
parent: NEIGHBOR | null | undefined;
get familyPosition(): FamilyPosition;
}
export interface IAbstractBinaryTree<N extends AbstractBinaryTreeNode<N['val'], N>> {
createNode(key: BinaryTreeNodeKey, val?: N['val'], count?: number): N | null;
get loopType(): LoopType;
get visitedKey(): BinaryTreeNodeKey[];
get visitedVal(): Array<N['val']>;
get visitedNode(): N[];
get root(): N | null;
get size(): number;
swapLocation(srcNode: N, destNode: N): N;
clear(): void;
isEmpty(): boolean;
add(key: BinaryTreeNodeKey | N, val?: N['val']): N | null | undefined;
addMany(keysOrNodes: (BinaryTreeNodeKey | N | null)[], data?: N['val'][]): (N | null | undefined)[];
refill(keysOrNodes: (BinaryTreeNodeKey | N | null)[], data?: N[] | Array<N['val']>): boolean;
remove(key: BinaryTreeNodeKey, ignoreCount?: boolean): BinaryTreeDeletedResult<N>[];
getDepth(node: N): number;
getHeight(beginRoot?: N | null): number;
getMinHeight(beginRoot?: N | null): number;
isPerfectlyBalanced(beginRoot?: N | null): boolean;
getNodes(nodeProperty: BinaryTreeNodeKey | N, propertyName?: BinaryTreeNodePropertyName, onlyOne?: boolean): N[];
has(nodeProperty: BinaryTreeNodeKey | N, propertyName?: BinaryTreeNodePropertyName): boolean;
get(nodeProperty: BinaryTreeNodeKey | N, propertyName?: BinaryTreeNodePropertyName): N | null;
getPathToRoot(node: N): N[];
getLeftMost(): N | null;
getLeftMost(node: N): N;
getLeftMost(node?: N | null): N | null;
getRightMost(): N | null;
getRightMost(node: N): N;
getRightMost(node?: N | null): N | null;
isSubtreeBST(node: N | null): boolean;
isBST(): boolean;
getSubTreeSize(subTreeRoot: N | null | undefined): number;
// --- start additional methods ---
subTreeSum(subTreeRoot: N, propertyName?: BinaryTreeNodePropertyName): number;
subTreeAdd(subTreeRoot: N, delta: number, propertyName?: BinaryTreeNodePropertyName): boolean;
bfs(): BinaryTreeNodeKey[];
bfs(nodeOrPropertyName: 'key'): BinaryTreeNodeKey[];
bfs(nodeOrPropertyName: 'val'): N['val'][];
bfs(nodeOrPropertyName: 'node'): N[];
bfs(nodeOrPropertyName: 'count'): number[];
bfs(nodeOrPropertyName?: NodeOrPropertyName): AbstractBinaryTreeNodeProperties<N>;
dfs(): BinaryTreeNodeKey[];
dfs(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'key'): BinaryTreeNodeKey[];
dfs(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'val'): N[];
dfs(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'node'): N[];
dfs(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'count'): number[];
dfs(pattern?: 'in' | 'pre' | 'post', nodeOrPropertyName?: NodeOrPropertyName): AbstractBinaryTreeNodeProperties<N>;
dfsIterative(): BinaryTreeNodeKey[];
dfsIterative(pattern: DFSOrderPattern): BinaryTreeNodeKey[];
dfsIterative(pattern: DFSOrderPattern, nodeOrPropertyName: 'key'): BinaryTreeNodeKey[];
dfsIterative(pattern: DFSOrderPattern, nodeOrPropertyName: 'val'): N['val'][];
dfsIterative(pattern: DFSOrderPattern, nodeOrPropertyName: 'node'): N[];
dfsIterative(pattern?: DFSOrderPattern, nodeOrPropertyName?: NodeOrPropertyName): AbstractBinaryTreeNodeProperties<N>;
levelIterative(node: N | null): BinaryTreeNodeKey[];
levelIterative(node: N | null, nodeOrPropertyName?: 'key'): BinaryTreeNodeKey[];
levelIterative(node: N | null, nodeOrPropertyName?: 'val'): N['val'][];
levelIterative(node: N | null, nodeOrPropertyName?: 'node'): N[];
levelIterative(node: N | null, nodeOrPropertyName?: 'count'): number[];
levelIterative(node: N | null, nodeOrPropertyName?: NodeOrPropertyName): AbstractBinaryTreeNodeProperties<N>;
listLevels(node: N | null): BinaryTreeNodeKey[][];
listLevels(node: N | null, nodeOrPropertyName?: 'key'): BinaryTreeNodeKey[][];
listLevels(node: N | null, nodeOrPropertyName?: 'val'): N['val'][][];
listLevels(node: N | null, nodeOrPropertyName?: 'node'): N[][];
listLevels(node: N | null, nodeOrPropertyName?: 'count'): number[][];
listLevels(node: N | null, nodeOrPropertyName?: NodeOrPropertyName): AbstractBinaryTreeNodeProperty<N>[][];
getPredecessor(node: N): N;
morris(): BinaryTreeNodeKey[];
morris(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'key'): BinaryTreeNodeKey[];
morris(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'val'): N[];
morris(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'node'): N[];
morris(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'count'): number[];
morris(pattern?: 'in' | 'pre' | 'post', nodeOrPropertyName?: NodeOrPropertyName): AbstractBinaryTreeNodeProperties<N>;
// --- end additional methods ---
}
import {VertexKey} from '../types';
export interface IAbstractGraph<V, E> {
hasVertex(vertexOrKey: V | VertexKey): boolean;
createVertex(key: VertexKey, val?: V): V;
addVertex(key: VertexKey, val?: V): boolean;
removeVertex(vertexOrKey: V | VertexKey): boolean;
removeAllVertices(vertices: V[] | VertexKey[]): boolean;
degreeOf(vertexOrKey: V | VertexKey): number;
edgesOf(vertexOrKey: V | VertexKey): E[];
hasEdge(src: V | VertexKey, dest: V | VertexKey): boolean;
getEdge(srcOrKey: V | VertexKey, destOrKey: V | VertexKey): E | null;
edgeSet(): E[];
addEdge(src: V | VertexKey, dest: V | VertexKey, weight: number, val: E): boolean;
removeEdge(edge: E): E | null;
setEdgeWeight(srcOrKey: V | VertexKey, destOrKey: V | VertexKey, weight: number): boolean;
getMinPathBetween(v1: V | VertexKey, v2: V | VertexKey, isWeight?: boolean): V[] | null;
getNeighbors(vertexOrKey: V | VertexKey): V[];
createEdge(srcOrV1: VertexKey | string, destOrV2: VertexKey | string, weight?: number, val?: E): E;
}
import {AVLTreeNode} from '../data-structures';
import {IBST, IBSTNode} from './bst';
import {BinaryTreeDeletedResult, BinaryTreeNodeKey} from '../types';

@@ -9,20 +8,2 @@ export interface IAVLTreeNode<T, NEIGHBOR extends IAVLTreeNode<T, NEIGHBOR>> extends IBSTNode<T, NEIGHBOR> {

export interface IAVLTree<N extends AVLTreeNode<N['val'], N>> extends IBST<N> {
add(key: BinaryTreeNodeKey, val?: N['val'] | null): N | null | undefined;
remove(key: BinaryTreeNodeKey): BinaryTreeDeletedResult<N>[];
// _balanceFactor(node: N): number
//
// _updateHeight(node: N): void
//
// _balancePath(node: N): void
//
// _balanceLL(A: N): void
//
// _balanceLR(A: N): void
//
// _balanceRR(A: N): void
//
// _balanceRL(A: N): void
}
export interface IAVLTree<N extends AVLTreeNode<N['val'], N>> extends IBST<N> {}
import {BinaryTreeNode} from '../data-structures';
import {IAbstractBinaryTree, IAbstractBinaryTreeNode} from './abstract-binary-tree';
export type IBinaryTreeNode<T, NEIGHBOR extends IBinaryTreeNode<T, NEIGHBOR>> = IAbstractBinaryTreeNode<T, NEIGHBOR>;
export interface IBinaryTreeNode<T, NEIGHBOR extends IBinaryTreeNode<T, NEIGHBOR>>
extends IAbstractBinaryTreeNode<T, NEIGHBOR> {}
export type IBinaryTree<N extends BinaryTreeNode<N['val'], N>> = IAbstractBinaryTree<N>;
export interface IBinaryTree<N extends BinaryTreeNode<N['val'], N>> extends IAbstractBinaryTree<N> {}
import {BSTNode} from '../data-structures';
import {IBinaryTree, IBinaryTreeNode} from './binary-tree';
import {BinaryTreeDeletedResult, BinaryTreeNodeKey, BinaryTreeNodePropertyName} from '../types';
export interface IBSTNode<T, NEIGHBOR extends IBSTNode<T, NEIGHBOR>> extends IBinaryTreeNode<T, NEIGHBOR> {}
export interface IBST<N extends BSTNode<N['val'], N>> extends IBinaryTree<N> {
createNode(key: BinaryTreeNodeKey, val?: N['val'], count?: number): N;
add(key: BinaryTreeNodeKey, val?: N['val'] | null, count?: number): N | null | undefined;
get(nodeProperty: BinaryTreeNodeKey | N, propertyName?: BinaryTreeNodePropertyName): N | null;
lastKey(): BinaryTreeNodeKey;
remove(key: BinaryTreeNodeKey, ignoreCount?: boolean): BinaryTreeDeletedResult<N>[];
getNodes(nodeProperty: BinaryTreeNodeKey | N, propertyName?: BinaryTreeNodePropertyName, onlyOne?: boolean): N[];
// --- start additional functions
lesserSum(key: BinaryTreeNodeKey, propertyName?: BinaryTreeNodePropertyName): number;
allGreaterNodesAdd(node: N, delta: number, propertyName?: BinaryTreeNodePropertyName): boolean;
perfectlyBalance(): boolean;
isAVLBalanced(): boolean;
// --- end additional functions
}
export interface IBST<N extends BSTNode<N['val'], N>> extends IBinaryTree<N> {}

@@ -1,20 +0,3 @@

import {VertexKey} from '../types';
import {IAbstractGraph} from './abstract-graph';
export interface IDirectedGraph<V, E> extends IAbstractGraph<V, E> {
incomingEdgesOf(vertex: V): E[];
outgoingEdgesOf(vertex: V): E[];
inDegreeOf(vertexOrKey: V | VertexKey): number;
outDegreeOf(vertexOrKey: V | VertexKey): number;
getEdgeSrc(e: E): V | null;
getEdgeDest(e: E): V | null;
removeEdgeSrcToDest(srcOrKey: V | VertexKey, destOrKey: V | VertexKey): E | null;
removeEdgesBetween(v1: V | VertexKey, v2: V | VertexKey): E[];
}
export interface IDirectedGraph<V, E> extends IAbstractGraph<V, E> {}
import {RBTreeNode} from '../data-structures';
import {IBST, IBSTNode} from './bst';
import {BinaryTreeNodeKey} from '../types';
export type IRBTreeNode<T, NEIGHBOR extends IRBTreeNode<T, NEIGHBOR>> = IBSTNode<T, NEIGHBOR>;
export interface IRBTreeNode<T, NEIGHBOR extends IRBTreeNode<T, NEIGHBOR>> extends IBSTNode<T, NEIGHBOR> {}
export interface IRBTree<N extends RBTreeNode<N['val'], N>> extends IBST<N> {
createNode(key: BinaryTreeNodeKey, val?: N['val'], count?: number): N;
}
export interface IRBTree<N extends RBTreeNode<N['val'], N>> extends IBST<N> {}
import {TreeMultisetNode} from '../data-structures';
import {IBSTNode} from './bst';
import {IAVLTree} from './avl-tree';
import {IAVLTree, IAVLTreeNode} from './avl-tree';
export type ITreeMultisetNode<T, NEIGHBOR extends ITreeMultisetNode<T, NEIGHBOR>> = IBSTNode<T, NEIGHBOR>;
export interface ITreeMultisetNode<T, NEIGHBOR extends ITreeMultisetNode<T, NEIGHBOR>>
extends IAVLTreeNode<T, NEIGHBOR> {}
export type ITreeMultiset<N extends TreeMultisetNode<N['val'], N>> = IAVLTree<N>;
export interface ITreeMultiset<N extends TreeMultisetNode<N['val'], N>> extends IAVLTree<N> {}

@@ -1,6 +0,3 @@

import {VertexKey} from '../types';
import {IAbstractGraph} from './abstract-graph';
export interface IUNDirectedGraph<V, E> extends IAbstractGraph<V, E> {
removeEdgeBetween(v1: V | VertexKey, v2: V | VertexKey): E | null;
}
export interface IUNDirectedGraph<V, E> extends IAbstractGraph<V, E> {}

@@ -352,3 +352,3 @@ import {DoublyLinkedList} from '../../../../src';

}
expect(performance.now() - startPushTime).toBeLessThan(bigO.LINEAR * 10);
expect(performance.now() - startPushTime).toBeLessThan(bigO.LINEAR * 20);

@@ -355,0 +355,0 @@ expect(list.length).toBeGreaterThan(0);

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