fp-search-algorithms
Version:
Functional Programming Style Search Algorithms and Unordered Containers
17 lines (16 loc) • 798 B
TypeScript
type Flag = {
val: boolean;
};
export type KeyValuePair<K, V> = [key: K, value: V];
export type Node<K, V> = {
children: Node<K, V>[];
kvs: KeyValuePair<K, V>[];
};
export declare const createEmptyNode: <K, V>() => Node<K, V>;
export declare const insert: <K, V>(root: Node<K, V>, key: K, val: V, addedLeaf: Flag) => Node<K, V>;
export declare const _remove: <K, V>(node: Node<K, V>, key: K) => KeyValuePair<K, V> | undefined;
export declare const remove: <K, V>(root: Node<K, V>, key: K) => KeyValuePair<K, V> | undefined;
export declare const printTree: <K, V>(node: Node<K, V>) => void;
export declare const traverse: <K, V>(node: Node<K, V>) => Generator<KeyValuePair<K, V>>;
export declare const find: <K, V>(node: Node<K, V>, key: K) => KeyValuePair<K, V> | undefined;
export {};