src/modules/BinarySearchTree.js
// Insert key into root if root is empty, else call the insertNode function.
Insert key into root if root is empty, else call the insertNode function.
Insert key into root if root is empty else call the insertNode function .
insert(key) {
    if (this.root == null) {
      this.root = new Node(key);
    } else {
      this.insertNode(this.root, key);
    }
  }
insert ( key ) { if ( this . root == null ) { this . root = new Node ( key ) ; } else { this . insertNode ( this . root , key ) ; } }
Insert key into root if root is empty, else call the insertNode function.
Insert key into root if root is empty else call the insertNode function .