data-structure-typed 1.18.5 → 1.18.6

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 (135) hide show
  1. package/dist/data-structures/binary-tree/abstract-binary-tree.d.ts +333 -0
  2. package/dist/data-structures/binary-tree/abstract-binary-tree.js +1455 -0
  3. package/dist/data-structures/binary-tree/avl-tree.d.ts +3 -2
  4. package/dist/data-structures/binary-tree/avl-tree.js +2 -2
  5. package/dist/data-structures/binary-tree/binary-tree.d.ts +6 -334
  6. package/dist/data-structures/binary-tree/binary-tree.js +26 -1436
  7. package/dist/data-structures/binary-tree/bst.d.ts +5 -12
  8. package/dist/data-structures/binary-tree/bst.js +31 -36
  9. package/dist/data-structures/binary-tree/index.d.ts +1 -0
  10. package/dist/data-structures/binary-tree/index.js +1 -0
  11. package/dist/data-structures/binary-tree/rb-tree.js +2 -6
  12. package/dist/data-structures/binary-tree/tree-multiset.d.ts +8 -23
  13. package/dist/data-structures/binary-tree/tree-multiset.js +26 -29
  14. package/dist/data-structures/graph/directed-graph.d.ts +2 -4
  15. package/dist/data-structures/graph/directed-graph.js +3 -7
  16. package/dist/data-structures/graph/undirected-graph.d.ts +13 -11
  17. package/dist/data-structures/graph/undirected-graph.js +14 -14
  18. package/dist/data-structures/interfaces/binary-tree.d.ts +1 -2
  19. package/dist/data-structures/types/abstract-binary-tree.d.ts +32 -0
  20. package/dist/data-structures/types/abstract-binary-tree.js +21 -0
  21. package/dist/data-structures/types/avl-tree.d.ts +2 -4
  22. package/dist/data-structures/types/binary-tree.d.ts +2 -10
  23. package/dist/data-structures/types/bst.d.ts +10 -5
  24. package/dist/data-structures/types/bst.js +7 -0
  25. package/dist/data-structures/types/helpers.d.ts +8 -0
  26. package/dist/data-structures/types/helpers.js +2 -0
  27. package/dist/data-structures/types/index.d.ts +3 -0
  28. package/dist/data-structures/types/index.js +3 -0
  29. package/dist/data-structures/types/rb-tree.d.ts +6 -0
  30. package/dist/data-structures/types/rb-tree.js +8 -0
  31. package/dist/data-structures/types/tree-multiset.d.ts +5 -3
  32. package/docs/assets/search.js +1 -1
  33. package/docs/classes/AVLTree.html +152 -152
  34. package/docs/classes/AVLTreeNode.html +38 -27
  35. package/docs/classes/AaTree.html +18 -7
  36. package/docs/classes/AbstractBinaryTree.html +2023 -0
  37. package/docs/classes/AbstractBinaryTreeNode.html +491 -0
  38. package/docs/classes/AbstractEdge.html +28 -17
  39. package/docs/classes/AbstractGraph.html +52 -41
  40. package/docs/classes/AbstractVertex.html +25 -14
  41. package/docs/classes/ArrayDeque.html +31 -20
  42. package/docs/classes/BST.html +140 -134
  43. package/docs/classes/BSTNode.html +40 -28
  44. package/docs/classes/BTree.html +18 -7
  45. package/docs/classes/BinaryIndexedTree.html +26 -15
  46. package/docs/classes/BinaryTree.html +447 -446
  47. package/docs/classes/BinaryTreeNode.html +107 -135
  48. package/docs/classes/Character.html +21 -10
  49. package/docs/classes/CoordinateMap.html +26 -15
  50. package/docs/classes/CoordinateSet.html +25 -14
  51. package/docs/classes/Deque.html +51 -40
  52. package/docs/classes/DirectedEdge.html +32 -21
  53. package/docs/classes/DirectedGraph.html +73 -147
  54. package/docs/classes/DirectedVertex.html +23 -12
  55. package/docs/classes/DoublyLinkedList.html +54 -43
  56. package/docs/classes/DoublyLinkedListNode.html +28 -17
  57. package/docs/classes/HashTable.html +18 -7
  58. package/docs/classes/Heap.html +32 -21
  59. package/docs/classes/HeapItem.html +25 -14
  60. package/docs/classes/Matrix2D.html +33 -22
  61. package/docs/classes/MatrixNTI2D.html +21 -10
  62. package/docs/classes/MaxHeap.html +32 -21
  63. package/docs/classes/MaxPriorityQueue.html +51 -40
  64. package/docs/classes/MinHeap.html +32 -21
  65. package/docs/classes/MinPriorityQueue.html +51 -40
  66. package/docs/classes/Navigator.html +27 -16
  67. package/docs/classes/ObjectDeque.html +42 -31
  68. package/docs/classes/Pair.html +18 -7
  69. package/docs/classes/PriorityQueue.html +49 -38
  70. package/docs/classes/Queue.html +31 -20
  71. package/docs/classes/SegmentTree.html +34 -23
  72. package/docs/classes/SegmentTreeNode.html +37 -26
  73. package/docs/classes/SinglyLinkedList.html +51 -40
  74. package/docs/classes/SinglyLinkedListNode.html +25 -14
  75. package/docs/classes/SkipLinkedList.html +18 -7
  76. package/docs/classes/SplayTree.html +18 -7
  77. package/docs/classes/Stack.html +29 -18
  78. package/docs/classes/TreeMap.html +18 -7
  79. package/docs/classes/TreeMultiSet.html +180 -173
  80. package/docs/classes/TreeMultiSetNode.html +450 -0
  81. package/docs/classes/TreeNode.html +33 -22
  82. package/docs/classes/TreeSet.html +18 -7
  83. package/docs/classes/Trie.html +30 -19
  84. package/docs/classes/TrieNode.html +28 -17
  85. package/docs/classes/TwoThreeTree.html +18 -7
  86. package/docs/classes/UndirectedEdge.html +29 -18
  87. package/docs/classes/UndirectedGraph.html +80 -142
  88. package/docs/classes/UndirectedVertex.html +23 -12
  89. package/docs/classes/Vector2D.html +45 -34
  90. package/docs/enums/CP.html +24 -13
  91. package/docs/enums/FamilyPosition.html +36 -25
  92. package/docs/enums/LoopType.html +30 -19
  93. package/docs/enums/RBColor.html +168 -0
  94. package/docs/enums/TopologicalProperty.html +21 -10
  95. package/docs/index.html +17 -6
  96. package/docs/interfaces/IBinaryTree.html +20 -8
  97. package/docs/interfaces/IBinaryTreeNode.html +41 -28
  98. package/docs/interfaces/IDirectedGraph.html +24 -13
  99. package/docs/interfaces/IGraph.html +37 -26
  100. package/docs/interfaces/IUNDirectedGraph.html +18 -7
  101. package/docs/modules.html +34 -12
  102. package/docs/types/{AVLTreeDeleted.html → AVLTreeOptions.html} +23 -21
  103. package/docs/types/AbstractBinaryTreeOptions.html +150 -0
  104. package/docs/types/AbstractRecursiveBinaryTreeNode.html +146 -0
  105. package/docs/types/{ResultsByProperty.html → AbstractResultByProperty.html} +23 -12
  106. package/docs/types/{TreeMultiSetDeletedResult.html → AbstractResultsByProperty.html} +23 -19
  107. package/docs/types/BSTComparator.html +18 -7
  108. package/docs/types/BSTOptions.html +146 -0
  109. package/docs/types/BinaryTreeDeletedResult.html +153 -0
  110. package/docs/types/BinaryTreeNodeId.html +18 -7
  111. package/docs/types/BinaryTreeNodePropertyName.html +18 -7
  112. package/docs/types/{BinaryTreeDeleted.html → BinaryTreeOptions.html} +23 -21
  113. package/docs/types/DFSOrderPattern.html +18 -7
  114. package/docs/types/DijkstraResult.html +18 -7
  115. package/docs/types/Direction.html +18 -7
  116. package/docs/types/EdgeId.html +18 -7
  117. package/docs/types/HeapOptions.html +18 -7
  118. package/docs/types/IdObject.html +151 -0
  119. package/docs/types/{ResultByProperty.html → KeyValObject.html} +27 -16
  120. package/docs/types/NavigatorParams.html +18 -7
  121. package/docs/types/NodeOrPropertyName.html +18 -7
  122. package/docs/types/PriorityQueueComparator.html +18 -7
  123. package/docs/types/PriorityQueueDFSOrderPattern.html +18 -7
  124. package/docs/types/PriorityQueueOptions.html +18 -7
  125. package/docs/types/{BSTDeletedResult.html → RBTreeOptions.html} +23 -21
  126. package/docs/types/RecursiveAVLTreeNode.html +18 -7
  127. package/docs/types/RecursiveBSTNode.html +18 -7
  128. package/docs/types/RecursiveBinaryTreeNode.html +18 -7
  129. package/docs/types/RecursiveTreeMultiSetNode.html +146 -0
  130. package/docs/types/SegmentTreeNodeVal.html +18 -7
  131. package/docs/types/TopologicalStatus.html +18 -7
  132. package/docs/types/TreeMultiSetOptions.html +146 -0
  133. package/docs/types/Turning.html +18 -7
  134. package/docs/types/VertexId.html +18 -7
  135. package/package.json +1 -1
@@ -0,0 +1,333 @@
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 { AbstractRecursiveBinaryTreeNode, AbstractResultsByProperty, BinaryTreeDeletedResult, BinaryTreeNodeId, BinaryTreeNodePropertyName, DFSOrderPattern, NodeOrPropertyName } from '../types';
9
+ import { AbstractBinaryTreeOptions, FamilyPosition, LoopType } from '../types';
10
+ import { IBinaryTree, IBinaryTreeNode } from '../interfaces';
11
+ export declare abstract class AbstractBinaryTreeNode<T, FAMILY extends AbstractBinaryTreeNode<T, FAMILY> = AbstractRecursiveBinaryTreeNode<T>> implements IBinaryTreeNode<T, FAMILY> {
12
+ constructor(id: BinaryTreeNodeId, val: T, count?: number);
13
+ private _id;
14
+ get id(): BinaryTreeNodeId;
15
+ set id(v: BinaryTreeNodeId);
16
+ private _val;
17
+ get val(): T;
18
+ set val(v: T);
19
+ private _left?;
20
+ get left(): FAMILY | null | undefined;
21
+ set left(v: FAMILY | null | undefined);
22
+ private _right?;
23
+ get right(): FAMILY | null | undefined;
24
+ set right(v: FAMILY | null | undefined);
25
+ private _parent;
26
+ get parent(): FAMILY | null | undefined;
27
+ set parent(v: FAMILY | null | undefined);
28
+ private _familyPosition;
29
+ get familyPosition(): FamilyPosition;
30
+ set familyPosition(v: FamilyPosition);
31
+ private _count;
32
+ get count(): number;
33
+ set count(v: number);
34
+ private _height;
35
+ get height(): number;
36
+ set height(v: number);
37
+ abstract _createNode(id: BinaryTreeNodeId, val: T | null, count?: number): FAMILY | null;
38
+ swapLocation(swapNode: FAMILY): FAMILY;
39
+ clone(): FAMILY | null;
40
+ }
41
+ export declare abstract class AbstractBinaryTree<N extends AbstractBinaryTreeNode<N['val'], N> = AbstractBinaryTreeNode<number>> implements IBinaryTree<N> {
42
+ /**
43
+ * The protected constructor initializes the options for an abstract binary tree.
44
+ * @param {AbstractBinaryTreeOptions} [options] - An optional object that contains configuration options for the binary
45
+ * tree.
46
+ */
47
+ protected constructor(options?: AbstractBinaryTreeOptions);
48
+ private _loopType;
49
+ get loopType(): LoopType;
50
+ private _visitedId;
51
+ get visitedId(): BinaryTreeNodeId[];
52
+ private _visitedVal;
53
+ get visitedVal(): Array<N['val']>;
54
+ private _visitedNode;
55
+ get visitedNode(): N[];
56
+ private _visitedCount;
57
+ get visitedCount(): number[];
58
+ private _visitedLeftSum;
59
+ get visitedLeftSum(): number[];
60
+ private _autoIncrementId;
61
+ get autoIncrementId(): boolean;
62
+ private _maxId;
63
+ get maxId(): number;
64
+ private _isDuplicatedVal;
65
+ get isDuplicatedVal(): boolean;
66
+ private _root;
67
+ get root(): N | null;
68
+ private _size;
69
+ get size(): number;
70
+ private _count;
71
+ get count(): number;
72
+ abstract _createNode(id: BinaryTreeNodeId, val: N['val'] | null, count?: number): N | null;
73
+ /**
74
+ * The clear function resets the state of an object by setting its properties to their initial values.
75
+ */
76
+ clear(): void;
77
+ /**
78
+ * The function checks if the size of an object is equal to zero and returns a boolean value.
79
+ * @returns A boolean value indicating whether the size of the object is 0 or not.
80
+ */
81
+ isEmpty(): boolean;
82
+ /**
83
+ * The `add` function inserts a new node with a given ID and value into a binary tree, updating the count if the node
84
+ * already exists.
85
+ * @param {BinaryTreeNodeId} id - The id parameter is the identifier of the binary tree node. It is used to uniquely
86
+ * identify each node in the binary tree.
87
+ * @param {N} val - The value to be inserted into the binary tree.
88
+ * @param {number} [count] - The `count` parameter is an optional parameter that specifies the number of times the
89
+ * value should be inserted into the binary tree. If not provided, it defaults to 1.
90
+ * @returns The function `add` returns a `N` object if a new node is inserted, or `null` if no new node
91
+ * is inserted, or `undefined` if the insertion fails.
92
+ */
93
+ add(id: BinaryTreeNodeId, val?: N['val'], count?: number): N | null | undefined;
94
+ /**
95
+ * The function inserts a new node into a binary tree as the left or right child of a given parent node.
96
+ * @param {N | null} newNode - The `newNode` parameter is an instance of the `BinaryTreeNode` class or
97
+ * `null`. It represents the node that needs to be inserted into the binary tree.
98
+ * @param parent - The `parent` parameter is a BinaryTreeNode object representing the parent node to which the new node
99
+ * will be inserted as a child.
100
+ * @returns The method returns the newly inserted node, either as the left child or the right child of the parent node.
101
+ */
102
+ addTo(newNode: N | null, parent: N): N | null | undefined;
103
+ /**
104
+ * The `addMany` function inserts multiple items into a binary tree and returns an array of the inserted nodes or
105
+ * null/undefined values.
106
+ * @param {N[] | N[]} data - The `data` parameter can be either an array of elements of type `N` or an
107
+ * array of `N` objects.
108
+ * @returns The function `addMany` returns an array of `N`, `null`, or `undefined` values.
109
+ */
110
+ addMany(data: N[] | Array<N['val']>): (N | null | undefined)[];
111
+ /**
112
+ * The `fill` function clears the current data and inserts new data, returning a boolean indicating if the insertion
113
+ * was successful.
114
+ * @param {N[] | N[]} data - The `data` parameter can be either an array of elements of type `N` or an
115
+ * array of `N` objects.
116
+ * @returns The method is returning a boolean value.
117
+ */
118
+ fill(data: N[] | Array<N['val']>): boolean;
119
+ /**
120
+ * The function removes a node from a binary tree and returns information about the deleted node.
121
+ * @param {BinaryTreeNodeId} id - The `id` parameter is the identifier of the binary tree node that you want to remove.
122
+ * It is of type `BinaryTreeNodeId`.
123
+ * @param {boolean} [ignoreCount] - The `ignoreCount` parameter is an optional boolean parameter that determines
124
+ * whether to ignore the count of the node being removed. If `ignoreCount` is set to `true`, the count of the node will
125
+ * not be decremented and the overall count of the binary tree will not be updated. If `
126
+ * @returns An array of objects is being returned. Each object in the array has two properties: "deleted" and
127
+ * "needBalanced". The "deleted" property contains the deleted node or undefined if no node was deleted. The
128
+ * "needBalanced" property is always null.
129
+ */
130
+ remove(id: BinaryTreeNodeId, ignoreCount?: boolean): BinaryTreeDeletedResult<N>[];
131
+ /**
132
+ * The function calculates the depth of a binary tree node by traversing its parent nodes.
133
+ * @param node - N - This is the node for which we want to calculate the depth. It is a generic type,
134
+ * meaning it can represent any type of data that we want to store in the node.
135
+ * @returns The depth of the given binary tree node.
136
+ */
137
+ getDepth(node: N): number;
138
+ /**
139
+ * The `getHeight` function calculates the maximum height of a binary tree using either a recursive or iterative
140
+ * approach.
141
+ * @param {N | null} [beginRoot] - The `beginRoot` parameter is an optional parameter of type
142
+ * `N | null`. It represents the starting node from which to calculate the height of the binary tree.
143
+ * If no value is provided for `beginRoot`, the function will use the `root` property of the class instance as
144
+ * @returns the height of the binary tree.
145
+ */
146
+ getHeight(beginRoot?: N | null): number;
147
+ /**
148
+ * The `getMinHeight` function calculates the minimum height of a binary tree using either a recursive or iterative
149
+ * approach.
150
+ * @param {N | null} [beginRoot] - The `beginRoot` parameter is an optional parameter of type
151
+ * `N | null`. It represents the starting node from which to calculate the minimum height of the binary
152
+ * tree. If no value is provided for `beginRoot`, the function will use the root node of the binary tree.
153
+ * @returns The function `getMinHeight` returns the minimum height of the binary tree.
154
+ */
155
+ getMinHeight(beginRoot?: N | null): number;
156
+ /**
157
+ * The function checks if a binary tree is balanced by comparing the minimum height and the maximum height of the tree.
158
+ * @param {N | null} [beginRoot] - The `beginRoot` parameter is the root node of a binary tree. It is
159
+ * of type `N | null`, which means it can either be a `BinaryTreeNode` object or `null`.
160
+ * @returns The method is returning a boolean value.
161
+ */
162
+ isBalanced(beginRoot?: N | null): boolean;
163
+ /**
164
+ * The function `getNodes` returns an array of binary tree nodes that match a given property value, with options for
165
+ * searching recursively or iteratively.
166
+ * @param {BinaryTreeNodeId | N} nodeProperty - The `nodeProperty` parameter can be either a `BinaryTreeNodeId` or a
167
+ * generic type `N`. It represents the property of the binary tree node that you want to search for.
168
+ * @param {BinaryTreeNodePropertyName} [propertyName] - The `propertyName` parameter is an optional parameter that
169
+ * specifies the property name to use when searching for nodes. If not provided, it defaults to 'id'.
170
+ * @param {boolean} [onlyOne] - The `onlyOne` parameter is an optional boolean parameter that determines whether to
171
+ * return only one node that matches the `nodeProperty` or `propertyName` criteria. If `onlyOne` is set to `true`, the
172
+ * function will stop traversing the tree and return the first matching node. If `
173
+ * @returns The function `getNodes` returns an array of `N | null | undefined` objects.
174
+ */
175
+ getNodes(nodeProperty: BinaryTreeNodeId | N, propertyName?: BinaryTreeNodePropertyName, onlyOne?: boolean): (N | null | undefined)[];
176
+ /**
177
+ * The function checks if a binary tree node has a specific property or if any node in the tree has a specific
178
+ * property.
179
+ * @param {BinaryTreeNodeId | N} nodeProperty - The `nodeProperty` parameter can be either a `BinaryTreeNodeId` or a
180
+ * generic type `N`. It represents the property of a binary tree node that you want to check.
181
+ * @param {BinaryTreeNodePropertyName} [propertyName] - The `propertyName` parameter is an optional parameter that
182
+ * specifies the name of the property to check for in the nodes.
183
+ * @returns a boolean value.
184
+ */
185
+ has(nodeProperty: BinaryTreeNodeId | N, propertyName?: BinaryTreeNodePropertyName): boolean;
186
+ /**
187
+ * The function returns the first binary tree node that matches the given property name and value, or null if no match
188
+ * is found.
189
+ * @param {BinaryTreeNodeId | N} nodeProperty - The `nodeProperty` parameter can be either a `BinaryTreeNodeId` or a
190
+ * generic type `N`. It represents the property of the binary tree node that you want to search for.
191
+ * @param {BinaryTreeNodePropertyName} [propertyName] - The `propertyName` parameter is an optional parameter that
192
+ * specifies the property of the binary tree node to search for. If not provided, it defaults to `'id'`.
193
+ * @returns a BinaryTreeNode object or null.
194
+ */
195
+ get(nodeProperty: BinaryTreeNodeId | N, propertyName?: BinaryTreeNodePropertyName): N | null;
196
+ /**
197
+ * The function getPathToRoot returns an array of BinaryTreeNode objects representing the path from a given node to the
198
+ * root of a binary tree.
199
+ * @param node - The `node` parameter is a BinaryTreeNode object.
200
+ * @returns The function `getPathToRoot` returns an array of `N` objects, representing the path from
201
+ * the given `node` to the root of the binary tree.
202
+ */
203
+ getPathToRoot(node: N): N[];
204
+ getLeftMost(): N | null;
205
+ getLeftMost(node: N): N;
206
+ getRightMost(): N | null;
207
+ getRightMost(node: N): N;
208
+ /**
209
+ * The `isBST` function checks if a binary tree is a binary search tree.
210
+ * @param {N | null} [node] - The `node` parameter is an optional parameter of type `N
211
+ * | null`. It represents the root node of the binary search tree (BST) that we want to check for validity. If no node
212
+ * is provided, the function will default to using the root node of the BST instance that
213
+ * @returns The `isBST` function returns a boolean value. It returns `true` if the binary tree is a valid binary search
214
+ * tree, and `false` otherwise.
215
+ */
216
+ isBST(node?: N | null): boolean;
217
+ /**
218
+ * The function calculates the size and count of a subtree in a binary tree using either recursive or iterative
219
+ * traversal.
220
+ * @param {N | null | undefined} subTreeRoot - The `subTreeRoot` parameter is the root node of a binary
221
+ * tree.
222
+ * @returns The function `getSubTreeSizeAndCount` returns an array `[number, number]`. The first element of the array
223
+ * represents the size of the subtree, and the second element represents the count of the nodes in the subtree.
224
+ */
225
+ getSubTreeSizeAndCount(subTreeRoot: N | null | undefined): [number, number];
226
+ /**
227
+ * The function `subTreeSum` calculates the sum of a specified property in a binary tree, either recursively or
228
+ * iteratively.
229
+ * @param subTreeRoot - The subTreeRoot parameter is the root node of the subtree for which you want to calculate the
230
+ * sum.
231
+ * @param {BinaryTreeNodePropertyName} [propertyName] - The `propertyName` parameter is an optional parameter that
232
+ * specifies the property of the `BinaryTreeNode` object to use for calculating the sum. If `propertyName` is not
233
+ * provided, it defaults to `'val'`.
234
+ * @returns a number, which is the sum of the values of the nodes in the subtree rooted at `subTreeRoot`.
235
+ */
236
+ subTreeSum(subTreeRoot: N, propertyName?: BinaryTreeNodePropertyName): number;
237
+ /**
238
+ * The function `subTreeAdd` adds a specified delta value to a property of each node in a binary tree.
239
+ * @param subTreeRoot - The `subTreeRoot` parameter is the root node of the subtree where the values will be modified.
240
+ * @param {number} delta - The `delta` parameter is a number that represents the amount by which the property value of
241
+ * each node in the subtree should be increased or decreased.
242
+ * @param {BinaryTreeNodePropertyName} [propertyName] - The `propertyName` parameter is an optional parameter that
243
+ * specifies the property of the `BinaryTreeNode` that should be modified. It defaults to `'id'` if not provided.
244
+ * @returns a boolean value, which is `true`.
245
+ */
246
+ subTreeAdd(subTreeRoot: N, delta: number, propertyName?: BinaryTreeNodePropertyName): boolean;
247
+ BFS(): BinaryTreeNodeId[];
248
+ BFS(nodeOrPropertyName: 'id'): BinaryTreeNodeId[];
249
+ BFS(nodeOrPropertyName: 'val'): N['val'][];
250
+ BFS(nodeOrPropertyName: 'node'): N[];
251
+ BFS(nodeOrPropertyName: 'count'): number[];
252
+ DFS(): BinaryTreeNodeId[];
253
+ DFS(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'id'): BinaryTreeNodeId[];
254
+ DFS(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'val'): N[];
255
+ DFS(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'node'): N[];
256
+ DFS(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'count'): number[];
257
+ DFSIterative(): BinaryTreeNodeId[];
258
+ DFSIterative(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'id'): BinaryTreeNodeId[];
259
+ DFSIterative(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'val'): N[];
260
+ DFSIterative(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'node'): N[];
261
+ DFSIterative(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'count'): number[];
262
+ levelIterative(node: N | null): BinaryTreeNodeId[];
263
+ levelIterative(node: N | null, nodeOrPropertyName?: 'id'): BinaryTreeNodeId[];
264
+ levelIterative(node: N | null, nodeOrPropertyName?: 'val'): N['val'][];
265
+ levelIterative(node: N | null, nodeOrPropertyName?: 'node'): N[];
266
+ levelIterative(node: N | null, nodeOrPropertyName?: 'count'): number[];
267
+ listLevels(node: N | null): BinaryTreeNodeId[][];
268
+ listLevels(node: N | null, nodeOrPropertyName?: 'id'): BinaryTreeNodeId[][];
269
+ listLevels(node: N | null, nodeOrPropertyName?: 'val'): N['val'][][];
270
+ listLevels(node: N | null, nodeOrPropertyName?: 'node'): N[][];
271
+ listLevels(node: N | null, nodeOrPropertyName?: 'count'): number[][];
272
+ /**
273
+ * The function returns the predecessor of a given node in a binary tree.
274
+ * @param node - The parameter `node` is a BinaryTreeNode object, representing a node in a binary tree.
275
+ * @returns the predecessor of the given node in a binary tree.
276
+ */
277
+ getPredecessor(node: N): N;
278
+ morris(): BinaryTreeNodeId[];
279
+ morris(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'id'): BinaryTreeNodeId[];
280
+ morris(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'val'): N[];
281
+ morris(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'node'): N[];
282
+ morris(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'count'): number[];
283
+ protected _setLoopType(value: LoopType): void;
284
+ protected _setVisitedId(value: BinaryTreeNodeId[]): void;
285
+ protected _setVisitedVal(value: Array<N>): void;
286
+ protected _setVisitedNode(value: N[]): void;
287
+ protected setVisitedCount(value: number[]): void;
288
+ protected _setVisitedLeftSum(value: number[]): void;
289
+ protected _setAutoIncrementId(value: boolean): void;
290
+ protected _setMaxId(value: number): void;
291
+ protected _setIsDuplicatedVal(value: boolean): void;
292
+ protected _setRoot(v: N | null): void;
293
+ protected _setSize(v: number): void;
294
+ protected _setCount(v: number): void;
295
+ /**
296
+ * The function resets the values of several arrays used for tracking visited nodes and their properties.
297
+ */
298
+ protected _resetResults(): void;
299
+ /**
300
+ * The function checks if a given property of a binary tree node matches a specified value, and if so, adds the node to
301
+ * a result array.
302
+ * @param cur - The current binary tree node that is being checked.
303
+ * @param {(N | null | undefined)[]} result - An array that stores the matching nodes found during the
304
+ * traversal.
305
+ * @param {BinaryTreeNodeId | N} nodeProperty - The `nodeProperty` parameter is the value that we are searching for in
306
+ * the binary tree nodes. It can be either the `id`, `count`, or `val` property of the node.
307
+ * @param {BinaryTreeNodePropertyName} [propertyName] - The `propertyName` parameter is an optional parameter that
308
+ * specifies the property of the `BinaryTreeNode` object that you want to compare with the `nodeProperty` value. It can
309
+ * be one of the following values: 'id', 'count', or 'val'. If no `propertyName` is provided,
310
+ * @param {boolean} [onlyOne] - The `onlyOne` parameter is an optional boolean parameter that determines whether to
311
+ * stop after finding the first matching node or continue searching for all matching nodes. If `onlyOne` is set to
312
+ * `true`, the function will stop after finding the first matching node and return `true`. If `onlyOne
313
+ * @returns a boolean value indicating whether or not a node was pushed into the result array.
314
+ */
315
+ protected _pushByPropertyNameStopOrNot(cur: N, result: (N | null | undefined)[], nodeProperty: BinaryTreeNodeId | N, propertyName?: BinaryTreeNodePropertyName, onlyOne?: boolean): boolean | undefined;
316
+ /**
317
+ * The function `_accumulatedByPropertyName` pushes a property value of a binary tree node into an array based on the
318
+ * provided property name or a default property name.
319
+ * @param node - The `node` parameter is of type `N`, which represents a node in a binary tree.
320
+ * @param {NodeOrPropertyName} [nodeOrPropertyName] - The parameter `nodeOrPropertyName` is an optional parameter that
321
+ * can be either a string representing a property name or a reference to a node object. If it is a string, it specifies
322
+ * the property name of the node that should be accumulated. If it is a node object, it specifies the node itself
323
+ */
324
+ protected _accumulatedByPropertyName(node: N, nodeOrPropertyName?: NodeOrPropertyName): void;
325
+ /**
326
+ * The function `_getResultByPropertyName` returns different results based on the provided property name or defaulting
327
+ * to 'id'.
328
+ * @param {NodeOrPropertyName} [nodeOrPropertyName] - The parameter `nodeOrPropertyName` is an optional parameter that
329
+ * can accept a value of type `NodeOrPropertyName`.
330
+ * @returns The method returns an object of type `AbstractResultsByProperty<T>`.
331
+ */
332
+ protected _getResultByPropertyName(nodeOrPropertyName?: NodeOrPropertyName): AbstractResultsByProperty<N>;
333
+ }