data-structure-typed/src/interfaces/binary-tree.ts

11 lines
461 B
TypeScript
Raw Normal View History

2023-09-22 02:43:16 +00:00
import {BinaryTreeNode} from '../data-structures';
import {BinaryTreeDeletedResult, BinaryTreeNodeKey, MapCallback} from '../types';
export interface IBinaryTree<N extends BinaryTreeNode<N['val'], N>> {
createNode(key: BinaryTreeNodeKey, val?: N['val']): N;
add(keyOrNode: BinaryTreeNodeKey | N | null, val?: N['val']): N | null | undefined;
delete<C extends MapCallback<N>>(identifier: ReturnType<C> | N, callback: C): BinaryTreeDeletedResult<N>[];
}