Add binary search tree.

This commit is contained in:
Oleksii Trekhleb 2018-04-02 20:26:29 +03:00
parent fbfdce030e
commit 8caf3a2201

View File

@ -28,8 +28,10 @@ export default class BinarySearchTreeNode extends BinaryTreeNode {
} }
if (value < this.value && this.left) { if (value < this.value && this.left) {
// Check left nodes.
return this.left.contains(value); return this.left.contains(value);
} else if (this.right) { } else if (this.right) {
// Check right nodes.
return this.right.contains(value); return this.right.contains(value);
} }