AlgoDaily Solution
1Locked, only available for premium members.
Community Solutions
Community solutions are only available for premium users.
Access all course materials today
The rest of this tutorial's contents are only available for premium members. Please explore your options at the link below.
xxxxxxxxxx
69
var assert = require('assert');
class BST {
constructor(val) {
this.root = new Node(val);
}
add(val) {
// fill this in
}
remove(val) {
// fill this in
}
}
// const bst = new BST(4);
// bst.add(3);
// bst.add(5);
// console.log(bst.root.left.val === 3);
// console.log(bst.root.right.val === 5);
function Node(val) {
this.val = val;
this.left = null;
this.right = null;
}
OUTPUT
Results will appear here.