red-black-tree-node
Version:
The algorithm of a self-balancing tree is used (Red-Black tree)
27 lines (26 loc) • 635 B
TypeScript
export declare enum Color {
red = "red",
black = "black"
}
export declare class Node {
private _key;
private _value;
private _color;
private _left;
private _right;
private _length;
constructor(key: string, value: any, color?: Color);
readonly key: string;
value: any;
readonly color: Color;
left: Node | null;
right: Node | null;
readonly length: number;
readonly isLeaf: boolean;
readonly isRed: boolean;
readonly isBlack: boolean;
forwardBalancer(): void;
private swapColors;
private rotateLeft;
private rotateRight;
}