2023-11-22 09:18:37 +00:00
|
|
|
import { BinaryTree, BinaryTreeNode } from '../data-structures';
|
2023-11-23 13:43:45 +00:00
|
|
|
import {
|
|
|
|
BinaryTreeNested,
|
|
|
|
BinaryTreeNodeNested,
|
|
|
|
BinaryTreeOptions,
|
|
|
|
BiTreeDeleteResult,
|
|
|
|
BTNCallback,
|
2023-11-25 12:40:11 +00:00
|
|
|
BTNodeExemplar,
|
2023-11-23 13:43:45 +00:00
|
|
|
} from '../types';
|
2023-08-22 00:58:42 +00:00
|
|
|
|
2023-12-04 13:58:41 +00:00
|
|
|
export interface IBinaryTree<K = number, V = any, N extends BinaryTreeNode<K, V, N> = BinaryTreeNodeNested<K, V>, TREE extends BinaryTree<K, V, N, TREE> = BinaryTreeNested<K, V, N>> {
|
|
|
|
createNode(key: K, value?: N['value']): N;
|
2023-08-22 00:58:42 +00:00
|
|
|
|
2023-12-04 13:58:41 +00:00
|
|
|
createTree(options?: Partial<BinaryTreeOptions<K>>): TREE;
|
2023-11-23 13:43:45 +00:00
|
|
|
|
2023-12-07 01:16:25 +00:00
|
|
|
add(keyOrNodeOrEntry: BTNodeExemplar<K, V, N>, value?: V, count?: number): N | null | undefined;
|
2023-11-23 13:43:45 +00:00
|
|
|
|
2023-12-04 13:58:41 +00:00
|
|
|
addMany(nodes: Iterable<BTNodeExemplar<K, V, N>>): (N | null | undefined)[];
|
2023-10-17 13:06:41 +00:00
|
|
|
|
2023-11-09 09:47:02 +00:00
|
|
|
delete<C extends BTNCallback<N>>(identifier: ReturnType<C> | null, callback: C): BiTreeDeleteResult<N>[];
|
2023-10-17 13:06:41 +00:00
|
|
|
}
|