///
import type { Compare } from '../../../types';
declare class AVLTree {
private compare;
/**
* 根节点
*/
private root;
/**
* 节点数
*/
private count;
/**
* 比较器类型错误
*/
static readonly CompareInvalidError: {
new (message?: string): {
name: string;
message: string;
stack?: string | undefined;
};
captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void;
prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
stackTraceLimit: number;
};
/**
* 重复value
*/
static readonly DuplicateValueError: {
new (message?: string): {
name: string;
message: string;
stack?: string | undefined;
};
captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void;
prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
stackTraceLimit: number;
};
constructor(compare: Compare, list?: [K, V][]);
/**
* 平衡节点
*/
private balanceNode;
/**
* 添加节点
*/
append(key: K, value: V): void;
/**
* 添加节点实现
*/
private appendNode;
/**
* 根据 key 移除节点
*/
remove(key: K): boolean;
/**
* 移除key相同的节点
*/
private removeNode;
/**
* 需要确保 node 不为 null
*/
private getMinNode;
has(key: K): boolean;
private hasKey;
getValue(key: K): V | undefined;
private getValueByKey;
/**
* 节点个数
*/
getSize(): number;
/**
* 清空树
*/
clear(): void;
forEach(callback: (value: V, key: K, context: AVLTree) => void): void;
toArray(): [K, V][];
[Symbol.iterator](): {
next: () => {
value: [K, V];
done: boolean;
};
};
}
export default AVLTree;