UNPKG

1.8 kBTypeScriptView Raw
1/**
2 * This is a Red Black Tree implementation
3 *
4 * @template K,V
5 */
6export class Tree<K, V> {
7 root: any;
8 length: number;
9 /**
10 * @param {K} id
11 */
12 findNext(id: K): V;
13 /**
14 * @param {K} id
15 */
16 findPrev(id: K): V;
17 /**
18 * @param {K} from
19 */
20 findNodeWithLowerBound(from: K): any;
21 /**
22 * @param {K} to
23 */
24 findNodeWithUpperBound(to: K): any;
25 /**
26 * @return {V}
27 */
28 findSmallestNode(): V;
29 /**
30 * @param {K} from
31 * @return {V}
32 */
33 findWithLowerBound(from: K): V;
34 /**
35 * @param {K} to
36 * @return {V}
37 */
38 findWithUpperBound(to: K): V;
39 /**
40 * @param {K} from
41 * @param {V} from
42 * @param {function(V):void} f
43 */
44 iterate(from: K, to: any, f: (arg0: V) => void): void;
45 /**
46 * @param {K} id
47 * @return {V|null}
48 */
49 find(id: K): V | null;
50 /**
51 * @param {K} id
52 * @return {N<V>|null}
53 */
54 findNode(id: K): N<V> | null;
55 /**
56 * @param {K} id
57 */
58 delete(id: K): void;
59 _fixDelete(n: any): void;
60 put(v: any): any;
61 _fixInsert(n: any): void;
62}
63/**
64 * @template V
65 */
66declare class N<V> {
67 /**
68 * A created node is always red!
69 *
70 * @param {V} val
71 */
72 constructor(val: V);
73 val: V;
74 color: boolean;
75 _left: any;
76 _right: any;
77 _parent: any;
78 isRed(): boolean;
79 isBlack(): boolean;
80 redden(): N<V>;
81 blacken(): N<V>;
82 get grandparent(): any;
83 get parent(): any;
84 get sibling(): any;
85 set left(arg: any);
86 get left(): any;
87 set right(arg: any);
88 get right(): any;
89 rotateLeft(tree: any): void;
90 next(): any;
91 prev(): any;
92 rotateRight(tree: any): void;
93 getUncle(): any;
94}
95export {};
96//# sourceMappingURL=tree.d.ts.map
\No newline at end of file