data-structure-typed 1.35.0 → 1.40.0-rc

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (173) hide show
  1. package/.github/workflows/ci.yml +3 -0
  2. package/CHANGELOG.md +3 -1
  3. package/CONTRIBUTING.md +18 -0
  4. package/dist/data-structures/binary-tree/aa-tree.d.ts +2 -0
  5. package/dist/data-structures/binary-tree/abstract-binary-tree.d.ts +527 -0
  6. package/dist/data-structures/binary-tree/abstract-binary-tree.js +323 -0
  7. package/dist/data-structures/binary-tree/abstract-binary-tree.js.map +1 -1
  8. package/dist/data-structures/binary-tree/avl-tree.d.ts +94 -0
  9. package/dist/data-structures/binary-tree/avl-tree.js +90 -3
  10. package/dist/data-structures/binary-tree/avl-tree.js.map +1 -1
  11. package/dist/data-structures/binary-tree/b-tree.d.ts +2 -0
  12. package/dist/data-structures/binary-tree/binary-indexed-tree.d.ts +46 -0
  13. package/dist/data-structures/binary-tree/binary-indexed-tree.js +36 -0
  14. package/dist/data-structures/binary-tree/binary-indexed-tree.js.map +1 -1
  15. package/dist/data-structures/binary-tree/binary-tree.d.ts +31 -0
  16. package/dist/data-structures/binary-tree/binary-tree.js +21 -0
  17. package/dist/data-structures/binary-tree/binary-tree.js.map +1 -1
  18. package/dist/data-structures/binary-tree/bst.d.ts +133 -0
  19. package/dist/data-structures/binary-tree/bst.js +114 -0
  20. package/dist/data-structures/binary-tree/bst.js.map +1 -1
  21. package/dist/data-structures/binary-tree/index.d.ts +12 -0
  22. package/dist/data-structures/binary-tree/rb-tree.d.ts +13 -0
  23. package/dist/data-structures/binary-tree/segment-tree.d.ts +83 -0
  24. package/dist/data-structures/binary-tree/segment-tree.js +45 -0
  25. package/dist/data-structures/binary-tree/segment-tree.js.map +1 -1
  26. package/dist/data-structures/binary-tree/splay-tree.d.ts +2 -0
  27. package/dist/data-structures/binary-tree/tree-multiset.d.ts +209 -0
  28. package/dist/data-structures/binary-tree/tree-multiset.js +178 -0
  29. package/dist/data-structures/binary-tree/tree-multiset.js.map +1 -1
  30. package/dist/data-structures/binary-tree/two-three-tree.d.ts +2 -0
  31. package/dist/data-structures/graph/abstract-graph.d.ts +332 -0
  32. package/dist/data-structures/graph/abstract-graph.js +269 -4
  33. package/dist/data-structures/graph/abstract-graph.js.map +1 -1
  34. package/dist/data-structures/graph/directed-graph.d.ts +200 -0
  35. package/dist/data-structures/graph/directed-graph.js +167 -0
  36. package/dist/data-structures/graph/directed-graph.js.map +1 -1
  37. package/dist/data-structures/graph/index.d.ts +4 -0
  38. package/dist/data-structures/graph/map-graph.d.ts +79 -0
  39. package/dist/data-structures/graph/map-graph.js +54 -0
  40. package/dist/data-structures/graph/map-graph.js.map +1 -1
  41. package/dist/data-structures/graph/undirected-graph.d.ts +127 -0
  42. package/dist/data-structures/graph/undirected-graph.js +105 -0
  43. package/dist/data-structures/graph/undirected-graph.js.map +1 -1
  44. package/dist/data-structures/hash/coordinate-map.d.ts +45 -0
  45. package/dist/data-structures/hash/coordinate-map.js +35 -0
  46. package/dist/data-structures/hash/coordinate-map.js.map +1 -1
  47. package/dist/data-structures/hash/coordinate-set.d.ts +37 -0
  48. package/dist/data-structures/hash/coordinate-set.js +28 -0
  49. package/dist/data-structures/hash/coordinate-set.js.map +1 -1
  50. package/dist/data-structures/hash/hash-map.d.ts +56 -0
  51. package/dist/data-structures/hash/hash-map.js +29 -1
  52. package/dist/data-structures/hash/hash-map.js.map +1 -1
  53. package/dist/data-structures/hash/hash-table.d.ts +106 -0
  54. package/dist/data-structures/hash/hash-table.js +88 -6
  55. package/dist/data-structures/hash/hash-table.js.map +1 -1
  56. package/dist/data-structures/hash/index.d.ts +7 -0
  57. package/dist/data-structures/hash/pair.d.ts +2 -0
  58. package/dist/data-structures/hash/tree-map.d.ts +2 -0
  59. package/dist/data-structures/hash/tree-set.d.ts +2 -0
  60. package/dist/data-structures/heap/heap.d.ts +83 -0
  61. package/dist/data-structures/heap/heap.js +62 -0
  62. package/dist/data-structures/heap/heap.js.map +1 -1
  63. package/dist/data-structures/heap/index.d.ts +3 -0
  64. package/dist/data-structures/heap/max-heap.d.ts +23 -0
  65. package/dist/data-structures/heap/max-heap.js +16 -0
  66. package/dist/data-structures/heap/max-heap.js.map +1 -1
  67. package/dist/data-structures/heap/min-heap.d.ts +24 -0
  68. package/dist/data-structures/heap/min-heap.js +17 -0
  69. package/dist/data-structures/heap/min-heap.js.map +1 -1
  70. package/dist/data-structures/index.d.ts +11 -0
  71. package/dist/data-structures/linked-list/doubly-linked-list.d.ts +234 -0
  72. package/dist/data-structures/linked-list/doubly-linked-list.js +202 -0
  73. package/dist/data-structures/linked-list/doubly-linked-list.js.map +1 -1
  74. package/dist/data-structures/linked-list/index.d.ts +3 -0
  75. package/dist/data-structures/linked-list/singly-linked-list.d.ts +157 -0
  76. package/dist/data-structures/linked-list/singly-linked-list.js +135 -0
  77. package/dist/data-structures/linked-list/singly-linked-list.js.map +1 -1
  78. package/dist/data-structures/linked-list/skip-linked-list.d.ts +61 -0
  79. package/dist/data-structures/linked-list/skip-linked-list.js +36 -0
  80. package/dist/data-structures/linked-list/skip-linked-list.js.map +1 -1
  81. package/dist/data-structures/matrix/index.d.ts +4 -0
  82. package/dist/data-structures/matrix/matrix.d.ts +21 -0
  83. package/dist/data-structures/matrix/matrix.js +15 -0
  84. package/dist/data-structures/matrix/matrix.js.map +1 -1
  85. package/dist/data-structures/matrix/matrix2d.d.ts +108 -0
  86. package/dist/data-structures/matrix/matrix2d.js +91 -2
  87. package/dist/data-structures/matrix/matrix2d.js.map +1 -1
  88. package/dist/data-structures/matrix/navigator.d.ts +52 -0
  89. package/dist/data-structures/matrix/navigator.js +28 -0
  90. package/dist/data-structures/matrix/navigator.js.map +1 -1
  91. package/dist/data-structures/matrix/vector2d.d.ts +201 -0
  92. package/dist/data-structures/matrix/vector2d.js +188 -1
  93. package/dist/data-structures/matrix/vector2d.js.map +1 -1
  94. package/dist/data-structures/priority-queue/index.d.ts +3 -0
  95. package/dist/data-structures/priority-queue/max-priority-queue.d.ts +15 -0
  96. package/dist/data-structures/priority-queue/max-priority-queue.js +18 -0
  97. package/dist/data-structures/priority-queue/max-priority-queue.js.map +1 -1
  98. package/dist/data-structures/priority-queue/min-priority-queue.d.ts +15 -0
  99. package/dist/data-structures/priority-queue/min-priority-queue.js +19 -0
  100. package/dist/data-structures/priority-queue/min-priority-queue.js.map +1 -1
  101. package/dist/data-structures/priority-queue/priority-queue.d.ts +180 -0
  102. package/dist/data-structures/priority-queue/priority-queue.js +141 -0
  103. package/dist/data-structures/priority-queue/priority-queue.js.map +1 -1
  104. package/dist/data-structures/queue/deque.d.ts +165 -0
  105. package/dist/data-structures/queue/deque.js +124 -0
  106. package/dist/data-structures/queue/deque.js.map +1 -1
  107. package/dist/data-structures/queue/index.d.ts +2 -0
  108. package/dist/data-structures/queue/queue.d.ts +107 -0
  109. package/dist/data-structures/queue/queue.js +80 -0
  110. package/dist/data-structures/queue/queue.js.map +1 -1
  111. package/dist/data-structures/stack/index.d.ts +1 -0
  112. package/dist/data-structures/stack/stack.d.ts +63 -0
  113. package/dist/data-structures/stack/stack.js +50 -0
  114. package/dist/data-structures/stack/stack.js.map +1 -1
  115. package/dist/data-structures/tree/index.d.ts +1 -0
  116. package/dist/data-structures/tree/tree.d.ts +14 -0
  117. package/dist/data-structures/tree/tree.js +1 -0
  118. package/dist/data-structures/tree/tree.js.map +1 -1
  119. package/dist/data-structures/trie/index.d.ts +1 -0
  120. package/dist/data-structures/trie/trie.d.ts +61 -0
  121. package/dist/data-structures/trie/trie.js +36 -0
  122. package/dist/data-structures/trie/trie.js.map +1 -1
  123. package/dist/index.d.ts +4 -0
  124. package/dist/interfaces/abstract-binary-tree.d.ts +7 -0
  125. package/dist/interfaces/abstract-graph.d.ts +5 -0
  126. package/dist/interfaces/avl-tree.d.ts +7 -0
  127. package/dist/interfaces/binary-tree.d.ts +6 -0
  128. package/dist/interfaces/bst.d.ts +6 -0
  129. package/dist/interfaces/directed-graph.d.ts +3 -0
  130. package/dist/interfaces/doubly-linked-list.d.ts +1 -0
  131. package/dist/interfaces/heap.d.ts +1 -0
  132. package/dist/interfaces/index.d.ts +15 -0
  133. package/dist/interfaces/navigator.d.ts +1 -0
  134. package/dist/interfaces/priority-queue.d.ts +1 -0
  135. package/dist/interfaces/rb-tree.d.ts +6 -0
  136. package/dist/interfaces/segment-tree.d.ts +1 -0
  137. package/dist/interfaces/singly-linked-list.d.ts +1 -0
  138. package/dist/interfaces/tree-multiset.d.ts +6 -0
  139. package/dist/interfaces/undirected-graph.d.ts +3 -0
  140. package/dist/types/data-structures/abstract-binary-tree.d.ts +34 -0
  141. package/dist/types/data-structures/abstract-binary-tree.js +6 -0
  142. package/dist/types/data-structures/abstract-binary-tree.js.map +1 -1
  143. package/dist/types/data-structures/abstract-graph.d.ts +11 -0
  144. package/dist/types/data-structures/avl-tree.d.ts +4 -0
  145. package/dist/types/data-structures/binary-tree.d.ts +4 -0
  146. package/dist/types/data-structures/bst.d.ts +13 -0
  147. package/dist/types/data-structures/directed-graph.d.ts +6 -0
  148. package/dist/types/data-structures/doubly-linked-list.d.ts +1 -0
  149. package/dist/types/data-structures/hash.d.ts +1 -0
  150. package/dist/types/data-structures/heap.d.ts +3 -0
  151. package/dist/types/data-structures/index.d.ts +16 -0
  152. package/dist/types/data-structures/map-graph.d.ts +1 -0
  153. package/dist/types/data-structures/navigator.d.ts +14 -0
  154. package/dist/types/data-structures/priority-queue.d.ts +7 -0
  155. package/dist/types/data-structures/rb-tree.d.ts +8 -0
  156. package/dist/types/data-structures/segment-tree.d.ts +1 -0
  157. package/dist/types/data-structures/singly-linked-list.d.ts +1 -0
  158. package/dist/types/data-structures/tree-multiset.d.ts +4 -0
  159. package/dist/types/helpers.d.ts +1 -0
  160. package/dist/types/index.d.ts +3 -0
  161. package/dist/types/utils/index.d.ts +2 -0
  162. package/dist/types/utils/utils.d.ts +7 -0
  163. package/dist/types/utils/validate-type.d.ts +19 -0
  164. package/dist/utils/index.d.ts +1 -0
  165. package/dist/utils/utils.d.ts +19 -0
  166. package/package.json +11 -7
  167. package/test/integration/avl-tree.test.ts +4 -4
  168. package/test/integration/bst.test.ts +8 -8
  169. package/test/unit/data-structures/graph/directed-graph.test.ts +5 -5
  170. package/test/unit/data-structures/graph/overall.test.ts +2 -2
  171. package/test/unit/data-structures/linked-list/singly-linked-list.test.ts +1 -1
  172. package/test/unit/data-structures/graph/index.ts +0 -2
  173. package/test/unit/data-structures/linked-list/index.ts +0 -4
@@ -44,6 +44,9 @@ jobs:
44
44
  - name: Build and documentation
45
45
  run: npm run build
46
46
 
47
+ - name: Update Individuals
48
+ run: npm run update:individuals
49
+
47
50
  - name: Run tests
48
51
  run: npm test
49
52
 
package/CHANGELOG.md CHANGED
@@ -8,7 +8,9 @@ All notable changes to this project will be documented in this file.
8
8
  - [Semantic Versioning](https://semver.org/spec/v2.0.0.html)
9
9
  - [`auto-changelog`](https://github.com/CookPete/auto-changelog)
10
10
 
11
- ## [v1.34.9](https://github.com/zrwusa/data-structure-typed/compare/v1.34.1...main) (upcoming)
11
+ ## [v1.35.1](https://github.com/zrwusa/data-structure-typed/compare/v1.35.0...main) (upcoming)
12
+
13
+ ## [v1.35.0](https://github.com/zrwusa/data-structure-typed/compare/v1.34.1...v1.35.0) (11 October 2023)
12
14
 
13
15
  ## [v1.34.1](https://github.com/zrwusa/data-structure-typed/compare/v1.33.4...v1.34.1) (6 October 2023)
14
16
 
package/CONTRIBUTING.md CHANGED
@@ -0,0 +1,18 @@
1
+ ## Contributing
2
+
3
+ **General Rules**
4
+
5
+ - As much as possible, try to follow the existing format of markdown and code.
6
+ - Don't forget to run `npm run lint` and `npm test` before submitting pull requests.
7
+ - Make sure that **100%** of your code is covered by tests.
8
+
9
+
10
+ **Contributing New Data Structures**
11
+
12
+ - Make your pull requests to be **specific** and **focused**. Instead of
13
+ contributing "several data structures" all at once contribute them all
14
+ one by one separately (i.e. one pull request for "RBTree", another one
15
+ for "AATree" and so on).
16
+ - Provide **README.md** for each of the data structure **with explanations** of
17
+ the algorithm and **with links** to further readings.
18
+ - Describe what you do in code using **comments**.
@@ -0,0 +1,2 @@
1
+ export declare class AaTree {
2
+ }
@@ -0,0 +1,527 @@
1
+ /**
2
+ * data-structure-typed
3
+ *
4
+ * @author Tyler Zeng
5
+ * @copyright Copyright (c) 2022 Tyler Zeng <zrwusa@gmail.com>
6
+ * @license MIT License
7
+ */
8
+ import type { AbstractBinaryTreeNodeNested, AbstractBinaryTreeNodeProperties, BinaryTreeDeletedResult, BinaryTreeNodeKey, BinaryTreeNodePropertyName, DFSOrderPattern, NodeOrPropertyName } from '../../types';
9
+ import { AbstractBinaryTreeOptions, FamilyPosition, LoopType } from '../../types';
10
+ import { IAbstractBinaryTree, IAbstractBinaryTreeNode } from '../../interfaces';
11
+ export declare abstract class AbstractBinaryTreeNode<V = any, NEIGHBOR extends AbstractBinaryTreeNode<V, NEIGHBOR> = AbstractBinaryTreeNodeNested<V>> implements IAbstractBinaryTreeNode<V, NEIGHBOR> {
12
+ /**
13
+ * The constructor function initializes a BinaryTreeNode object with a key and an optional value.
14
+ * @param {BinaryTreeNodeKey} key - The `key` parameter is of type `BinaryTreeNodeKey` and represents the unique identifier
15
+ * of the binary tree node. It is used to distinguish one node from another in the binary tree.
16
+ * @param {V} [val] - The "val" parameter is an optional parameter of type V. It represents the value that will be
17
+ * stored in the binary tree node. If no value is provided, it will be set to undefined.
18
+ */
19
+ protected constructor(key: BinaryTreeNodeKey, val?: V);
20
+ key: BinaryTreeNodeKey;
21
+ val: V | undefined;
22
+ private _left;
23
+ get left(): NEIGHBOR | null | undefined;
24
+ set left(v: NEIGHBOR | null | undefined);
25
+ private _right;
26
+ get right(): NEIGHBOR | null | undefined;
27
+ set right(v: NEIGHBOR | null | undefined);
28
+ parent: NEIGHBOR | null | undefined;
29
+ /**
30
+ * The function determines the position of a node in a family tree structure.
31
+ * @returns a value of type `FamilyPosition`.
32
+ */
33
+ get familyPosition(): FamilyPosition;
34
+ }
35
+ export declare abstract class AbstractBinaryTree<N extends AbstractBinaryTreeNode<N['val'], N> = AbstractBinaryTreeNode> implements IAbstractBinaryTree<N> {
36
+ /**
37
+ * The protected constructor initializes the options for an abstract binary tree.
38
+ * @param {AbstractBinaryTreeOptions} [options] - An optional object that contains configuration options for the binary
39
+ * tree.
40
+ */
41
+ protected constructor(options?: AbstractBinaryTreeOptions);
42
+ private _root;
43
+ get root(): N | null;
44
+ private _size;
45
+ get size(): number;
46
+ private _loopType;
47
+ get loopType(): LoopType;
48
+ visitedKey: BinaryTreeNodeKey[];
49
+ visitedVal: N['val'][];
50
+ visitedNode: N[];
51
+ abstract createNode(key: BinaryTreeNodeKey, val?: N['val']): N | null;
52
+ /**
53
+ * The `swapLocation` function swaps the location of two nodes in a binary tree.
54
+ * @param {N} srcNode - The source node that you want to swap with the destination node.
55
+ * @param {N} destNode - The `destNode` parameter represents the destination node where the values from `srcNode` will
56
+ * be swapped to.
57
+ * @returns The `destNode` is being returned.
58
+ */
59
+ swapLocation(srcNode: N, destNode: N): N;
60
+ /**
61
+ * The clear() function resets the root, size, and maxKey properties to their initial values.
62
+ */
63
+ clear(): void;
64
+ /**
65
+ * The function checks if the size of an object is equal to zero and returns a boolean value.
66
+ * @returns A boolean value indicating whether the size of the object is 0 or not.
67
+ */
68
+ isEmpty(): boolean;
69
+ /**
70
+ * When all leaf nodes are null, it will no longer be possible to add new entity nodes to this binary tree.
71
+ * In this scenario, null nodes serve as "sentinel nodes," "virtual nodes," or "placeholder nodes."
72
+ */
73
+ /**
74
+ * The `add` function adds a new node to a binary tree, either by ID or by creating a new node with a given value.
75
+ * @param {BinaryTreeNodeKey | N | null} keyOrNode - The `keyOrNode` parameter can be either a `BinaryTreeNodeKey`, which
76
+ * is a number representing the ID of a binary tree node, or it can be a `N` object, which represents a binary tree
77
+ * node itself. It can also be `null` if no node is specified.
78
+ * @param [val] - The `val` parameter is an optional value that can be assigned to the `val` property of the new node
79
+ * being added to the binary tree.
80
+ * @returns The function `add` returns either the inserted node (`N`), `null`, or `undefined`.
81
+ */
82
+ add(keyOrNode: BinaryTreeNodeKey | N | null, val?: N['val']): N | null | undefined;
83
+ /**
84
+ * The `addMany` function takes an array of binary tree node IDs or nodes, and optionally an array of corresponding data
85
+ * values, and adds them to the binary tree.
86
+ * @param {(BinaryTreeNodeKey | null)[] | (N | null)[]} keysOrNodes - An array of BinaryTreeNodeKey or BinaryTreeNode
87
+ * objects, or null values.
88
+ * @param {N['val'][]} [data] - The `data` parameter is an optional array of values (`N['val'][]`) that corresponds to
89
+ * the nodes or node IDs being added. It is used to set the value of each node being added. If `data` is not provided,
90
+ * the value of the nodes will be `undefined`.
91
+ * @returns The function `addMany` returns an array of `N`, `null`, or `undefined` values.
92
+ */
93
+ addMany(keysOrNodes: (BinaryTreeNodeKey | null)[] | (N | null)[], data?: N['val'][]): (N | null | undefined)[];
94
+ /**
95
+ * The `refill` function clears the binary tree and adds multiple nodes with the given IDs or nodes and optional data.
96
+ * @param {(BinaryTreeNodeKey | N)[]} keysOrNodes - The `keysOrNodes` parameter is an array that can contain either
97
+ * `BinaryTreeNodeKey` or `N` values.
98
+ * @param {N[] | Array<N['val']>} [data] - The `data` parameter is an optional array of values that will be assigned to
99
+ * the nodes being added. If provided, the length of the `data` array should be equal to the length of the `keysOrNodes`
100
+ * array. Each value in the `data` array will be assigned to the
101
+ * @returns The method is returning a boolean value.
102
+ */
103
+ refill(keysOrNodes: (BinaryTreeNodeKey | null)[] | (N | null)[], data?: N[] | Array<N['val']>): boolean;
104
+ /**
105
+ * The `remove` function in TypeScript is used to delete a node from a binary search tree and returns an array of objects
106
+ * containing the deleted node and the node that needs to be balanced.
107
+ * @param {N | BinaryTreeNodeKey} nodeOrKey - The `nodeOrKey` parameter can be either a node object (`N`) or a binary tree
108
+ * node ID (`BinaryTreeNodeKey`).
109
+ * @returns The function `remove` returns an array of `BinaryTreeDeletedResult<N>` objects.
110
+ */
111
+ remove(nodeOrKey: N | BinaryTreeNodeKey): BinaryTreeDeletedResult<N>[];
112
+ /**
113
+ * The function calculates the depth of a node in a binary tree.
114
+ * @param {N | BinaryTreeNodeKey | null} beginRoot - The `beginRoot` parameter can be one of the following:
115
+ * @returns the depth of the given node or binary tree.
116
+ */
117
+ getDepth(beginRoot?: N | BinaryTreeNodeKey | null): number;
118
+ /**
119
+ * The `getHeight` function calculates the maximum height of a binary tree, either recursively or iteratively.
120
+ * @param {N | BinaryTreeNodeKey | null} [beginRoot] - The `beginRoot` parameter is optional and can be of type `N` (a
121
+ * generic type representing a node in a binary tree), `BinaryTreeNodeKey` (a type representing the ID of a binary tree
122
+ * node), or `null`.
123
+ * @returns the height of the binary tree.
124
+ */
125
+ getHeight(beginRoot?: N | BinaryTreeNodeKey | null): number;
126
+ /**
127
+ * The `getMinHeight` function calculates the minimum height of a binary tree using either a recursive or iterative
128
+ * approach.
129
+ * @param {N | null} [beginRoot] - The `beginRoot` parameter is an optional parameter of type `N` or `null`. It
130
+ * represents the starting node from which to calculate the minimum height of a binary tree. If no value is provided
131
+ * for `beginRoot`, the `this.root` property is used as the default value.
132
+ * @returns The function `getMinHeight` returns the minimum height of the binary tree.
133
+ */
134
+ getMinHeight(beginRoot?: N | null): number;
135
+ /**
136
+ * The function checks if a binary tree is perfectly balanced by comparing the minimum height and the height of the
137
+ * tree.
138
+ * @param {N | null} [beginRoot] - The parameter `beginRoot` is of type `N` or `null`. It represents the root node of a
139
+ * tree or null if the tree is empty.
140
+ * @returns The method is returning a boolean value.
141
+ */
142
+ isPerfectlyBalanced(beginRoot?: N | null): boolean;
143
+ /**
144
+ * The function `getNodes` returns an array of nodes that match a given property name and value in a binary tree.
145
+ * @param {BinaryTreeNodeKey | N} nodeProperty - The `nodeProperty` parameter can be either a `BinaryTreeNodeKey` or a
146
+ * generic type `N`. It represents the property of the binary tree node that you want to search for.
147
+ * @param {BinaryTreeNodePropertyName} [propertyName] - The `propertyName` parameter is an optional parameter that
148
+ * specifies the property name to use when searching for nodes. If not provided, it defaults to 'key'.
149
+ * @param {boolean} [onlyOne] - The `onlyOne` parameter is an optional boolean parameter that determines whether to
150
+ * return only one node that matches the given `nodeProperty` or `propertyName`. If `onlyOne` is set to `true`, the
151
+ * function will stop traversing the tree and return the first matching node. If `only
152
+ * @returns an array of nodes (type N).
153
+ */
154
+ getNodes(nodeProperty: BinaryTreeNodeKey | N, propertyName?: BinaryTreeNodePropertyName, onlyOne?: boolean): N[];
155
+ /**
156
+ * The function checks if a binary tree node has a specific property.
157
+ * @param {BinaryTreeNodeKey | N} nodeProperty - The `nodeProperty` parameter can be either a `BinaryTreeNodeKey` or `N`.
158
+ * It represents the property of the binary tree node that you want to check.
159
+ * @param {BinaryTreeNodePropertyName} [propertyName] - The `propertyName` parameter is an optional parameter that
160
+ * specifies the name of the property to be checked in the nodes. If not provided, it defaults to 'key'.
161
+ * @returns a boolean value.
162
+ */
163
+ has(nodeProperty: BinaryTreeNodeKey | N, propertyName?: BinaryTreeNodePropertyName): boolean;
164
+ /**
165
+ * The function returns the first node that matches the given property name and value, or null if no matching node is
166
+ * found.
167
+ * @param {BinaryTreeNodeKey | N} nodeProperty - The `nodeProperty` parameter can be either a `BinaryTreeNodeKey` or `N`.
168
+ * It represents the property of the binary tree node that you want to search for.
169
+ * @param {BinaryTreeNodePropertyName} [propertyName] - The `propertyName` parameter is an optional parameter that
170
+ * specifies the property name to be used for searching the binary tree nodes. If this parameter is not provided, the
171
+ * default value is set to `'key'`.
172
+ * @returns either the value of the specified property of the node, or the node itself if no property name is provided.
173
+ * If no matching node is found, it returns null.
174
+ */
175
+ get(nodeProperty: BinaryTreeNodeKey | N, propertyName?: BinaryTreeNodePropertyName): N | null;
176
+ /**
177
+ * The function `getPathToRoot` returns an array of nodes representing the path from a given node to the root node, with
178
+ * an option to reverse the order of the nodes.
179
+ * @param {N} node - The `node` parameter represents a node in a tree structure. It is of type `N`, which could be any
180
+ * type that represents a node in your specific implementation.
181
+ * @param {boolean} [isReverse=true] - The `isReverse` parameter is a boolean flag that determines whether the resulting
182
+ * path should be reversed or not. If `isReverse` is set to `true`, the path will be reversed before returning it. If
183
+ * `isReverse` is set to `false` or not provided, the path will
184
+ * @returns The function `getPathToRoot` returns an array of nodes (`N[]`).
185
+ */
186
+ getPathToRoot(node: N, isReverse?: boolean): N[];
187
+ /**
188
+ * The function `getLeftMost` returns the leftmost node in a binary tree, starting from a specified node or the root if
189
+ * no node is specified.
190
+ * generic type representing a node in a binary tree), `BinaryTreeNodeKey` (a type representing the ID of a binary tree
191
+ * node), or `null`.
192
+ * @returns The function `getLeftMost` returns the leftmost node in a binary tree. If the `beginRoot` parameter is
193
+ * provided, it starts the traversal from that node. If `beginRoot` is not provided or is `null`, it starts the traversal
194
+ * from the root of the binary tree. The function returns the leftmost node found during the traversal. If no leftmost
195
+ * node is found (
196
+ */
197
+ getLeftMost(): N | null;
198
+ /**
199
+ * The function `getLeftMost` returns the leftmost node in a binary tree, starting from a specified node or the root if
200
+ * no node is specified.
201
+ * @param {N | BinaryTreeNodeKey | null} [node] - The `beginRoot` parameter is optional and can be of type `N` (a
202
+ * generic type representing a node in a binary tree), `BinaryTreeNodeKey` (a type representing the ID of a binary tree
203
+ * node).
204
+ * @returns The function `getLeftMost` returns the leftmost node in a binary tree. If the `beginRoot` parameter is
205
+ * provided, it starts the traversal from that node. If `beginRoot` is not provided or is `null`, it starts the traversal
206
+ * from the root of the binary tree. The function returns the leftmost node found during the traversal. If no leftmost
207
+ * node is found (
208
+ */
209
+ getLeftMost(node: N): N;
210
+ /**
211
+ * The `getRightMost` function returns the rightmost node in a binary tree, either recursively or iteratively using tail
212
+ * recursion optimization.
213
+ * @returns The `getRightMost` function returns the rightmost node in a binary tree. It returns the
214
+ * rightmost node starting from the root of the binary tree.
215
+ */
216
+ getRightMost(): N | null;
217
+ /**
218
+ * The `getRightMost` function returns the rightmost node in a binary tree, either recursively or iteratively using tail
219
+ * recursion optimization.
220
+ * @param {N | null} [beginRoot] - The `node` parameter is an optional parameter of type `N` or `null`. It represents the
221
+ * starting node from which we want to find the rightmost node. If no node is provided, the function will default to
222
+ * using the root node of the data structure.
223
+ * @returns The `getRightMost` function returns the rightmost node in a binary tree. It returns the rightmost node
224
+ * starting from that node.
225
+ */
226
+ getRightMost(beginRoot: N): N;
227
+ /**
228
+ * The function checks if a binary search tree is valid by traversing it either recursively or iteratively.
229
+ * @param {N | null} node - The `node` parameter represents the root node of a binary search tree (BST).
230
+ * @returns a boolean value.
231
+ */
232
+ isSubtreeBST(node: N | null): boolean;
233
+ /**
234
+ * The function isBST checks if the binary tree is valid binary search tree.
235
+ * @returns The `isBST()` function is returning a boolean value.
236
+ */
237
+ isBST(): boolean;
238
+ /**
239
+ * The function calculates the size of a subtree by traversing it either recursively or iteratively.
240
+ * @param {N | null | undefined} subTreeRoot - The `subTreeRoot` parameter represents the root node of a subtree in a
241
+ * binary tree.
242
+ * @returns the size of the subtree rooted at `subTreeRoot`.
243
+ */
244
+ getSubTreeSize(subTreeRoot: N | null | undefined): number;
245
+ /**
246
+ * The function `subTreeSum` calculates the sum of a specified property in a binary tree or subtree.
247
+ * @param {N | BinaryTreeNodeKey | null} subTreeRoot - The `subTreeRoot` parameter represents the root node of a binary
248
+ * tree or the ID of a binary tree node. It can also be `null` if there is no subtree.
249
+ * @param {BinaryTreeNodePropertyName} [propertyName] - propertyName is an optional parameter that specifies the
250
+ * property of the binary tree node to use for calculating the sum. It can be either 'key' or 'val'. If propertyName is
251
+ * not provided, it defaults to 'key'.
252
+ * @returns a number, which is the sum of the values of the specified property in the subtree rooted at `subTreeRoot`.
253
+ */
254
+ subTreeSum(subTreeRoot: N | BinaryTreeNodeKey | null, propertyName?: BinaryTreeNodePropertyName): number;
255
+ /**
256
+ * The function `subTreeAdd` adds a delta value to a specified property of each node in a subtree.
257
+ * @param {N | BinaryTreeNodeKey | null} subTreeRoot - The `subTreeRoot` parameter represents the root node of a binary
258
+ * tree or the ID of a node in the binary tree. It can also be `null` if there is no subtree to add to.
259
+ * @param {number} delta - The `delta` parameter is a number that represents the amount by which the property value of
260
+ * each node in the subtree should be incremented.
261
+ * @param {BinaryTreeNodePropertyName} [propertyName] - The `propertyName` parameter is an optional parameter that
262
+ * specifies the property of the binary tree node that should be modified. If not provided, it defaults to 'key'.
263
+ * @returns a boolean value.
264
+ */
265
+ subTreeAdd(subTreeRoot: N | BinaryTreeNodeKey | null, delta: number, propertyName?: BinaryTreeNodePropertyName): boolean;
266
+ /**
267
+ * Performs a breadth-first search (bfs) on a binary tree, accumulating properties of each node based on their 'key' property.
268
+ * @returns An array of binary tree node IDs.
269
+ */
270
+ bfs(): BinaryTreeNodeKey[];
271
+ /**
272
+ * Performs a breadth-first search (bfs) on a binary tree, accumulating properties of each node based on the specified property name.
273
+ * @param {'key'} nodeOrPropertyName - The name of the property to accumulate.
274
+ * @returns An array of values corresponding to the specified property.
275
+ */
276
+ bfs(nodeOrPropertyName: 'key'): BinaryTreeNodeKey[];
277
+ /**
278
+ * Performs a breadth-first search (bfs) on a binary tree, accumulating the 'val' property of each node.
279
+ * @param {'val'} nodeOrPropertyName - The name of the property to accumulate.
280
+ * @returns An array of 'val' properties from each node.
281
+ */
282
+ bfs(nodeOrPropertyName: 'val'): N['val'][];
283
+ /**
284
+ * Performs a breadth-first search (bfs) on a binary tree, accumulating nodes themselves.
285
+ * @param {'node'} nodeOrPropertyName - The name of the property to accumulate.
286
+ * @returns An array of binary tree nodes.
287
+ */
288
+ bfs(nodeOrPropertyName: 'node'): N[];
289
+ /**
290
+ * Performs a depth-first search (dfs) traversal on a binary tree and accumulates properties of each node based on their 'key' property.
291
+ * @returns An array of binary tree node IDs.
292
+ */
293
+ dfs(): BinaryTreeNodeKey[];
294
+ /**
295
+ * Performs a depth-first search (dfs) traversal on a binary tree and accumulates properties of each node based on the specified property name.
296
+ * @param {'in' | 'pre' | 'post'} [pattern] - The traversal pattern: 'in' (in-order), 'pre' (pre-order), or 'post' (post-order).
297
+ * @returns An array of values corresponding to the specified property.
298
+ */
299
+ dfs(pattern: DFSOrderPattern): BinaryTreeNodeKey[];
300
+ /**
301
+ * Performs a depth-first search (dfs) traversal on a binary tree and accumulates properties of each node based on the specified property name.
302
+ * @param {'in' | 'pre' | 'post'} [pattern] - The traversal pattern: 'in' (in-order), 'pre' (pre-order), or 'post' (post-order).
303
+ * @param {string} nodeOrPropertyName - The name of the property to accumulate.
304
+ * @returns An array of values corresponding to the specified property.
305
+ */
306
+ dfs(pattern: DFSOrderPattern, nodeOrPropertyName: 'key'): BinaryTreeNodeKey[];
307
+ /**
308
+ * Performs a depth-first search (dfs) traversal on a binary tree and accumulates the 'val' property of each node.
309
+ * @param {'in' | 'pre' | 'post'} [pattern] - The traversal pattern: 'in' (in-order), 'pre' (pre-order), or 'post' (post-order).
310
+ * @param {'val'} nodeOrPropertyName - The name of the property to accumulate.
311
+ * @returns An array of 'val' properties from each node.
312
+ */
313
+ dfs(pattern: DFSOrderPattern, nodeOrPropertyName: 'val'): N[];
314
+ /**
315
+ * Performs a depth-first search (dfs) traversal on a binary tree and accumulates nodes themselves.
316
+ * @param {'in' | 'pre' | 'post'} [pattern] - The traversal pattern: 'in' (in-order), 'pre' (pre-order), or 'post' (post-order).
317
+ * @param {'node'} nodeOrPropertyName - The name of the property to accumulate.
318
+ * @returns An array of binary tree nodes.
319
+ */
320
+ dfs(pattern: DFSOrderPattern, nodeOrPropertyName: 'node'): N[];
321
+ /**
322
+ * Performs an iterative depth-first search (dfs) traversal on a binary tree and accumulates properties of each node based on their 'key' property.
323
+ * @returns An array of binary tree node IDs.
324
+ */
325
+ dfsIterative(): BinaryTreeNodeKey[];
326
+ /**
327
+ * Performs an iterative depth-first search (dfs) traversal on a binary tree and accumulates properties of each node based on their 'key' property.
328
+ * @param {'in' | 'pre' | 'post'} [pattern] - The traversal pattern: 'in' (in-order), 'pre' (pre-order), or 'post' (post-order).
329
+ * @returns An array of values corresponding to the specified property.
330
+ */
331
+ dfsIterative(pattern: DFSOrderPattern): BinaryTreeNodeKey[];
332
+ /**
333
+ * Performs an iterative depth-first search (dfs) traversal on a binary tree and accumulates properties of each node based on the specified property name.
334
+ * @param {'in' | 'pre' | 'post'} [pattern] - The traversal pattern: 'in' (in-order), 'pre' (pre-order), or 'post' (post-order).
335
+ * @param {string} nodeOrPropertyName - The name of the property to accumulate.
336
+ * @returns An array of values corresponding to the specified property.
337
+ */
338
+ dfsIterative(pattern: DFSOrderPattern, nodeOrPropertyName: 'key'): BinaryTreeNodeKey[];
339
+ /**
340
+ * Performs an iterative depth-first search (dfs) traversal on a binary tree and accumulates the 'val' property of each node.
341
+ * @param {'in' | 'pre' | 'post'} [pattern] - The traversal pattern: 'in' (in-order), 'pre' (pre-order), or 'post' (post-order).
342
+ * @param {'val'} nodeOrPropertyName - The name of the property to accumulate.
343
+ * @returns An array of 'val' properties from each node.
344
+ */
345
+ dfsIterative(pattern: DFSOrderPattern, nodeOrPropertyName: 'val'): N['val'][];
346
+ /**
347
+ * Performs an iterative depth-first search (dfs) traversal on a binary tree and accumulates nodes themselves.
348
+ * @param {'in' | 'pre' | 'post'} [pattern] - The traversal pattern: 'in' (in-order), 'pre' (pre-order), or 'post' (post-order).
349
+ * @param {'node'} nodeOrPropertyName - The name of the property to accumulate.
350
+ * @returns An array of binary tree nodes.
351
+ */
352
+ dfsIterative(pattern: DFSOrderPattern, nodeOrPropertyName: 'node'): N[];
353
+ /**
354
+ * Performs a level-order traversal on a binary tree starting from the specified node and accumulates properties of each node based on their 'key' property.
355
+ * @returns An array of binary tree node IDs.
356
+ */
357
+ levelIterative(): BinaryTreeNodeKey[];
358
+ /**
359
+ * Performs a level-order traversal on a binary tree starting from the specified node and accumulates properties of each node based on their 'key' property.
360
+ * @param {N | null} node - The starting node for the level order traversal. If null, the root node of the tree is used as the starting node.
361
+ * @returns An array of binary tree node IDs.
362
+ */
363
+ levelIterative(node: N | null): BinaryTreeNodeKey[];
364
+ /**
365
+ * Performs a level-order traversal on a binary tree starting from the specified node and accumulates properties of each node based on the specified property name.
366
+ * @param {N | null} node - The starting node for the level order traversal. If null, the root node of the tree is used as the starting node.
367
+ * @param {string} nodeOrPropertyName - The name of the property to accumulate.
368
+ * @returns An array of values corresponding to the specified property.
369
+ */
370
+ levelIterative(node: N | null, nodeOrPropertyName: 'key'): BinaryTreeNodeKey[];
371
+ /**
372
+ * Performs a level-order traversal on a binary tree starting from the specified node and accumulates the 'val' property of each node.
373
+ * @param {N | null} node - The starting node for the level order traversal. If null, the root node of the tree is used as the starting node.
374
+ * @param {'val'} nodeOrPropertyName - The name of the property to accumulate.
375
+ * @returns An array of 'val' properties from each node.
376
+ */
377
+ levelIterative(node: N | null, nodeOrPropertyName: 'val'): N['val'][];
378
+ /**
379
+ * Performs a level-order traversal on a binary tree starting from the specified node and accumulates nodes themselves.
380
+ * @param {N | null} node - The starting node for the level order traversal. If null, the root node of the tree is used as the starting node.
381
+ * @param {'node'} nodeOrPropertyName - The name of the property to accumulate.
382
+ * @returns An array of binary tree nodes.
383
+ */
384
+ levelIterative(node: N | null, nodeOrPropertyName: 'node'): N[];
385
+ /**
386
+ * Collects nodes from a binary tree by a specified property and organizes them into levels.
387
+ * @returns A 2D array of AbstractBinaryTreeNodeProperty<N> objects.
388
+ */
389
+ listLevels(): BinaryTreeNodeKey[][];
390
+ /**
391
+ * Collects nodes from a binary tree by a specified property and organizes them into levels.
392
+ * @param {N | null} node - The root node of the binary tree or null. If null, the function will use the root node of the current binary tree instance.
393
+ * @returns A 2D array of AbstractBinaryTreeNodeProperty<N> objects.
394
+ */
395
+ listLevels(node: N | null): BinaryTreeNodeKey[][];
396
+ /**
397
+ * Collects nodes from a binary tree by a specified property and organizes them into levels.
398
+ * @param {N | null} node - The root node of the binary tree or null. If null, the function will use the root node of the current binary tree instance.
399
+ * @param {'key} nodeOrPropertyName - The property of the BinaryTreeNode object to collect at each level.
400
+ * @returns A 2D array of values corresponding to the specified property.
401
+ */
402
+ listLevels(node: N | null, nodeOrPropertyName: 'key'): BinaryTreeNodeKey[][];
403
+ /**
404
+ * Collects nodes from a binary tree by a specified property and organizes them into levels.
405
+ * @param {N | null} node - The root node of the binary tree or null. If null, the function will use the root node of the current binary tree instance.
406
+ * @param {'val'} nodeOrPropertyName - The property of the BinaryTreeNode object to collect at each level.
407
+ * @returns A 2D array of 'val' properties from each node.
408
+ */
409
+ listLevels(node: N | null, nodeOrPropertyName: 'val'): N['val'][][];
410
+ /**
411
+ * Collects nodes from a binary tree by a specified property and organizes them into levels.
412
+ * @param {N | null} node - The root node of the binary tree or null. If null, the function will use the root node of the current binary tree instance.
413
+ * @param {'node'} nodeOrPropertyName - The property of the BinaryTreeNode object to collect at each level.
414
+ * @returns A 2D array of binary tree nodes.
415
+ */
416
+ listLevels(node: N | null, nodeOrPropertyName: 'node'): N[][];
417
+ /**
418
+ * The function returns the predecessor of a given node in a binary tree.
419
+ * @param node - The parameter `node` is a BinaryTreeNode object, representing a node in a binary tree.
420
+ * @returns the predecessor of the given node in a binary tree.
421
+ */
422
+ getPredecessor(node: N): N;
423
+ /**
424
+ * Time complexity is O(n)
425
+ * Space complexity of Iterative dfs equals to recursive dfs which is O(n) because of the stack
426
+ */
427
+ /**
428
+ * Performs an in-order, pre-order, or post-order traversal on a binary tree using the Morris traversal algorithm.
429
+ * @returns An array of binary tree node IDs.
430
+ */
431
+ morris(): BinaryTreeNodeKey[];
432
+ /**
433
+ * Performs an in-order, pre-order, or post-order traversal on a binary tree using the Morris traversal algorithm and accumulates properties of each node based on the specified property name.
434
+ * @param {'in' | 'pre' | 'post'} [pattern] - The traversal pattern: 'in' (in-order), 'pre' (pre-order), or 'post' (post-order).
435
+ * @param {'key'} nodeOrPropertyName - The name of the property to accumulate.
436
+ * @returns An array of values corresponding to the specified property.
437
+ */
438
+ morris(pattern: DFSOrderPattern, nodeOrPropertyName: 'key'): BinaryTreeNodeKey[];
439
+ /**
440
+ * Performs an in-order, pre-order, or post-order traversal on a binary tree using the Morris traversal algorithm and accumulates properties of each node based on the specified property name.
441
+ * @param {'in' | 'pre' | 'post'} [pattern] - The traversal pattern: 'in' (in-order), 'pre' (pre-order), or 'post' (post-order).
442
+ * @returns An array of values corresponding to the specified property.
443
+ */
444
+ morris(pattern: DFSOrderPattern): BinaryTreeNodeKey[];
445
+ /**
446
+ * Performs an in-order, pre-order, or post-order traversal on a binary tree using the Morris traversal algorithm and accumulates the 'val' property of each node.
447
+ * @param {'in' | 'pre' | 'post'} [pattern] - The traversal pattern: 'in' (in-order), 'pre' (pre-order), or 'post' (post-order).
448
+ * @param {'val'} nodeOrPropertyName - The property of the BinaryTreeNode object to collect at each level.
449
+ * @returns An array of 'val' properties from each node.
450
+ */
451
+ morris(pattern: DFSOrderPattern, nodeOrPropertyName: 'val'): N[];
452
+ /**
453
+ * Performs an in-order, pre-order, or post-order traversal on a binary tree using the Morris traversal algorithm and accumulates nodes themselves.
454
+ * @param {'in' | 'pre' | 'post'} [pattern] - The traversal pattern: 'in' (in-order), 'pre' (pre-order), or 'post' (post-order).
455
+ * @param {'node'} nodeOrPropertyName - The property of the BinaryTreeNode object to collect at each level.
456
+ * @returns An array of binary tree nodes.
457
+ */
458
+ morris(pattern: DFSOrderPattern, nodeOrPropertyName: 'node'): N[];
459
+ /**
460
+ * The function adds a new node to a binary tree if there is an available position.
461
+ * @param {N | null} newNode - The `newNode` parameter is of type `N | null`, which means it can either be a node of
462
+ * type `N` or `null`. It represents the node that you want to add to the binary tree.
463
+ * @param {N} parent - The parent parameter is of type N, which represents a node in a binary tree.
464
+ * @returns either the left or right child node of the parent node, depending on which child is available for adding
465
+ * the new node. If a new node is added, the function also updates the size of the binary tree. If neither the left nor
466
+ * right child is available, the function returns undefined. If the parent node is null, the function also returns
467
+ * undefined.
468
+ */
469
+ protected _addTo(newNode: N | null, parent: N): N | null | undefined;
470
+ /**
471
+ * The function sets the loop type for a protected variable.
472
+ * @param {LoopType} value - The value parameter is of type LoopType.
473
+ */
474
+ protected _setLoopType(value: LoopType): void;
475
+ /**
476
+ * The function sets the root property of an object to a given value, and if the value is not null, it also sets the
477
+ * parent property of the value to undefined.
478
+ * @param {N | null} v - The parameter `v` is of type `N | null`, which means it can either be of type `N` or `null`.
479
+ */
480
+ protected _setRoot(v: N | null): void;
481
+ /**
482
+ * The function sets the size of a protected variable.
483
+ * @param {number} v - number
484
+ */
485
+ protected _setSize(v: number): void;
486
+ /**
487
+ * The function `_clearResults` resets the values of several arrays used for tracking visited nodes and their
488
+ * properties.
489
+ */
490
+ protected _clearResults(): void;
491
+ /**
492
+ * The function checks if a given property of a binary tree node matches a specified value, and if so, adds the node to
493
+ * a result array.
494
+ * @param {N} cur - The current node being processed.
495
+ * @param {(N | null | undefined)[]} result - An array that stores the matching nodes.
496
+ * @param {BinaryTreeNodeKey | N} nodeProperty - The `nodeProperty` parameter is either a `BinaryTreeNodeKey` or a `N`
497
+ * type. It represents the property value that we are comparing against in the switch statement.
498
+ * @param {BinaryTreeNodePropertyName} [propertyName] - The `propertyName` parameter is an optional parameter that
499
+ * specifies the property name to compare against when pushing nodes into the `result` array. It can be either `'key'`
500
+ * or `'val'`. If it is not provided or is not equal to `'key'` or `'val'`, the
501
+ * @param {boolean} [onlyOne] - The `onlyOne` parameter is an optional boolean parameter that determines whether to
502
+ * stop after finding the first matching node or continue searching for all matching nodes. If `onlyOne` is set to
503
+ * `true`, the function will stop after finding the first matching node and return `true`. If `onlyOne
504
+ * @returns a boolean value indicating whether only one matching node should be pushed into the result array.
505
+ */
506
+ protected _pushByPropertyNameStopOrNot(cur: N, result: (N | null | undefined)[], nodeProperty: BinaryTreeNodeKey | N, propertyName?: BinaryTreeNodePropertyName, onlyOne?: boolean): boolean | undefined;
507
+ /**
508
+ * The function `_accumulatedByPropertyName` accumulates values from a given node based on the specified property name.
509
+ * @param {N} node - The `node` parameter is of type `N`, which represents a node in a data structure.
510
+ * @param {NodeOrPropertyName} [nodeOrPropertyName] - The `nodeOrPropertyName` parameter is an optional parameter that
511
+ * can be either a string representing a property name or a reference to a `Node` object. If it is a string, it
512
+ * specifies the property name to be used for accumulating values. If it is a `Node` object, it specifies
513
+ */
514
+ protected _accumulatedByPropertyName(node: N, nodeOrPropertyName?: NodeOrPropertyName): void;
515
+ /**
516
+ * The time complexity of Morris traversal is O(n), it may slower than others
517
+ * The space complexity Morris traversal is O(1) because no using stack
518
+ */
519
+ /**
520
+ * The function `_getResultByPropertyName` returns the corresponding property value based on the given node or property
521
+ * name.
522
+ * @param {NodeOrPropertyName} [nodeOrPropertyName] - The parameter `nodeOrPropertyName` is an optional parameter that
523
+ * can accept either a `NodeOrPropertyName` type or be undefined.
524
+ * @returns The method `_getResultByPropertyName` returns an instance of `AbstractBinaryTreeNodeProperties<N>`.
525
+ */
526
+ protected _getResultByPropertyName(nodeOrPropertyName?: NodeOrPropertyName): AbstractBinaryTreeNodeProperties<N>;
527
+ }