2023-09-22 02:43:16 +00:00
|
|
|
import {BinaryTreeNode} from '../data-structures';
|
2023-10-30 03:14:41 +00:00
|
|
|
import {BinaryTreeDeletedResult, BTNKey, BinaryTreeNodeNested, BTNCallback} from '../types';
|
2023-08-22 00:58:42 +00:00
|
|
|
|
2023-10-27 10:04:31 +00:00
|
|
|
export interface IBinaryTree<V = any, N extends BinaryTreeNode<V, N> = BinaryTreeNodeNested<V>> {
|
2023-10-30 12:27:08 +00:00
|
|
|
createNode(key: BTNKey, value?: N['value']): N;
|
2023-08-22 00:58:42 +00:00
|
|
|
|
2023-10-30 12:27:08 +00:00
|
|
|
add(keyOrNode: BTNKey | N | null, value?: N['value']): N | null | undefined;
|
2023-10-17 13:06:41 +00:00
|
|
|
|
2023-10-30 03:14:41 +00:00
|
|
|
delete<C extends BTNCallback<N>>(identifier: ReturnType<C> | null, callback: C): BinaryTreeDeletedResult<N>[];
|
2023-10-17 13:06:41 +00:00
|
|
|
}
|