+
+
+
+```js
+var displayTree = (tree) => console.log(JSON.stringify(tree, null, 2));
+function Node(value) {
+ this.value = value;
+ this.left = null;
+ this.right = null;
+}
+function BinarySearchTree() {
+ this.root = null;
+}
+function isBinarySearchTree(tree) {
+ // change code below this line
+ // change code above this line
+}
+```
+
+
+
+### After Test
+
+
+```js
+BinarySearchTree.prototype.push = function(val) {
+ var root = this.root;
+
+ if (!root) {
+ this.root = new Node(val);
+ return;
+ }
+
+ var currentNode = root;
+ var newNode = new Node(val);
+
+ while (currentNode) {
+ if (val < currentNode.value) {
+ if (!currentNode.left) {
+ currentNode.left = newNode;
+ break;
+ } else {
+ currentNode = currentNode.left;
+ }
+ } else {
+ if (!currentNode.right) {
+ currentNode.right = newNode;
+ break;
+ } else {
+ currentNode = currentNode.right;
+ }
+ }
+ }
+};
+```
+
+
+
+
+
+## Solution
+
+