Set up node comparator for BST.

This commit is contained in:
Oleksii Trekhleb 2018-06-01 08:28:36 +03:00
parent 02299b77e6
commit 4132522d4a

View File

@ -6,6 +6,9 @@ export default class BinarySearchTree {
*/
constructor(nodeValueCompareFunction) {
this.root = new BinarySearchTreeNode(null, nodeValueCompareFunction);
// Steal node comparator from the root.
this.nodeComparator = this.root.nodeComparator;
}
/**