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