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

11 lines
412 B
TypeScript
Raw Normal View History

2023-09-22 02:43:16 +00:00
import {BinaryTreeNode} from '../data-structures';
import {BinaryTreeDeletedResult, BinaryTreeNodeKey} 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;
remove(nodeOrKey: N | BinaryTreeNodeKey): BinaryTreeDeletedResult<N>[];
}