5f0c4f7d1ce321fd3e7d8238d7e3821041449e52278b67f05a55829bf2bbe5bc5dd4c6adb412d7a6072b8f7ade8b62b37bf527de6a805b77cc6c1c63e2e088 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. export declare const enum TreeNodeColor {
  2. RED = 1,
  3. BLACK = 0
  4. }
  5. export declare class TreeNode<K, V> {
  6. _color: TreeNodeColor;
  7. _key: K | undefined;
  8. _value: V | undefined;
  9. _left: TreeNode<K, V> | undefined;
  10. _right: TreeNode<K, V> | undefined;
  11. _parent: TreeNode<K, V> | undefined;
  12. constructor(key?: K, value?: V);
  13. /**
  14. * @description Get the pre node.
  15. * @returns TreeNode about the pre node.
  16. */
  17. _pre(): TreeNode<K, V>;
  18. /**
  19. * @description Get the next node.
  20. * @returns TreeNode about the next node.
  21. */
  22. _next(): TreeNode<K, V>;
  23. /**
  24. * @description Rotate left.
  25. * @returns TreeNode about moved to original position after rotation.
  26. */
  27. _rotateLeft(): TreeNode<K, V>;
  28. /**
  29. * @description Rotate right.
  30. * @returns TreeNode about moved to original position after rotation.
  31. */
  32. _rotateRight(): TreeNode<K, V>;
  33. }
  34. export declare class TreeNodeEnableIndex<K, V> extends TreeNode<K, V> {
  35. _subTreeSize: number;
  36. /**
  37. * @description Rotate left and do recount.
  38. * @returns TreeNode about moved to original position after rotation.
  39. */
  40. _rotateLeft(): TreeNodeEnableIndex<K, V>;
  41. /**
  42. * @description Rotate right and do recount.
  43. * @returns TreeNode about moved to original position after rotation.
  44. */
  45. _rotateRight(): TreeNodeEnableIndex<K, V>;
  46. _recount(): void;
  47. }