mirror of
https://github.moeyy.xyz/https://github.com/trekhleb/javascript-algorithms.git
synced 2024-12-26 23:21:18 +08:00
Set up node comparator for BST.
This commit is contained in:
parent
02299b77e6
commit
4132522d4a
@ -6,6 +6,9 @@ export default class BinarySearchTree {
|
|||||||
*/
|
*/
|
||||||
constructor(nodeValueCompareFunction) {
|
constructor(nodeValueCompareFunction) {
|
||||||
this.root = new BinarySearchTreeNode(null, nodeValueCompareFunction);
|
this.root = new BinarySearchTreeNode(null, nodeValueCompareFunction);
|
||||||
|
|
||||||
|
// Steal node comparator from the root.
|
||||||
|
this.nodeComparator = this.root.nodeComparator;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user