diff --git a/src/data-structures/binary-tree/binary-tree.ts b/src/data-structures/binary-tree/binary-tree.ts index de5a89e..358bd9d 100644 --- a/src/data-structures/binary-tree/binary-tree.ts +++ b/src/data-structures/binary-tree/binary-tree.ts @@ -288,7 +288,7 @@ export class BinaryTree< */ ensureNode( keyOrNodeOrEntryOrRawElement: R | BTNKeyOrNodeOrEntry, - iterationType: IterationType = 'ITERATIVE' + iterationType: IterationType = this.iterationType ): OptBTNOrNull { if (keyOrNodeOrEntryOrRawElement === null) return null; if (keyOrNodeOrEntryOrRawElement === undefined) return; @@ -800,7 +800,7 @@ export class BinaryTree< * It has a default value of `'ITERATIVE'`. * @returns a value of type NODE, null, or undefined. */ - getNodeByKey(key: K, iterationType: IterationType = 'ITERATIVE'): OptBTNOrNull { + getNodeByKey(key: K, iterationType: IterationType = this.iterationType): OptBTNOrNull { return this.getNode(key, this._DEFAULT_CALLBACK, this.root, iterationType); } @@ -1417,7 +1417,7 @@ export class BinaryTree< callback: C = this._DEFAULT_CALLBACK as C, pattern: DFSOrderPattern = 'IN', beginRoot: R | BTNKeyOrNodeOrEntry = this.root, - iterationType: IterationType = 'ITERATIVE', + iterationType: IterationType = this.iterationType, includeNull = false ): ReturnType[] { beginRoot = this.ensureNode(beginRoot); diff --git a/src/data-structures/binary-tree/bst.ts b/src/data-structures/binary-tree/bst.ts index 2805a89..5788820 100644 --- a/src/data-structures/binary-tree/bst.ts +++ b/src/data-structures/binary-tree/bst.ts @@ -195,7 +195,7 @@ export class BST< */ override ensureNode( keyOrNodeOrEntryOrRawElement: R | BTNKeyOrNodeOrEntry, - iterationType: IterationType = 'ITERATIVE' + iterationType: IterationType = this.iterationType ): OptBSTN { return super.ensureNode(keyOrNodeOrEntryOrRawElement, iterationType) ?? undefined; } @@ -522,7 +522,7 @@ export class BST< * It has a default value of `'ITERATIVE'`. * @returns The method is returning a NODE object or undefined. */ - override getNodeByKey(key: K, iterationType: IterationType = 'ITERATIVE'): OptBSTN { + override getNodeByKey(key: K, iterationType: IterationType = this.iterationType): OptBSTN { return this.getNode(key, this._DEFAULT_CALLBACK, this.root, iterationType); } @@ -555,7 +555,7 @@ export class BST< callback: C = this._DEFAULT_CALLBACK as C, pattern: DFSOrderPattern = 'IN', beginRoot: R | BTNKeyOrNodeOrEntry = this.root, - iterationType: IterationType = 'ITERATIVE' + iterationType: IterationType = this.iterationType ): ReturnType[] { return super.dfs(callback, pattern, beginRoot, iterationType, false); }