UNPKG

typescript-algorithms-and-datastructures

Version:
20 lines (19 loc) 819 B
import IBinaryTree from "../Interfaces/IBinaryTree"; import { IBinaryTreeNode } from "../Interfaces/IBinaryTreeNode"; export declare class BinaryTree<T> implements IBinaryTree<T, IBinaryTreeNode<T>> { comparator: (a: T, b: T) => boolean; root: IBinaryTreeNode<T>; constructor(comparator?: (a: T, b: T) => boolean); add(value: T): void; remove(value: T): boolean; inOrderTreeWalk(callback: (pv: any, cv: T) => any, initialValue: any): any; isEmpty(): boolean; max(): IBinaryTreeNode<T>; min(): IBinaryTreeNode<T>; reverseTreeWalk(callback: (pv: any, cv: T) => any, initialValue: any): any; search(value: T): IBinaryTreeNode<T>; successor(value: T): IBinaryTreeNode<T>; private inorderNodeWalk; private reverseNodeWalk; private transplant; }