Skip to content

Commit 4132522

Browse files
committed
Set up node comparator for BST.
1 parent 02299b7 commit 4132522

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/data-structures/tree/binary-search-tree/BinarySearchTree.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ export default class BinarySearchTree {
66
*/
77
constructor(nodeValueCompareFunction) {
88
this.root = new BinarySearchTreeNode(null, nodeValueCompareFunction);
9+
10+
// Steal node comparator from the root.
11+
this.nodeComparator = this.root.nodeComparator;
912
}
1013

1114
/**

0 commit comments

Comments
 (0)