<commit_before>var Node = function (data, left, right) {
  this.data = data;
  this.left = left;
  this.right = right;
}

var BinarySearchTree = function () {
  this.root = null;
}

BinarySearchTree.prototype = {
  constructor: BinarySearchTree,

  insert: function (root, data) {
    if (root == null) {
      root = new Node(data);

      if (this.root === null)
        this.root = root;
    } else if (data <= root.data){
      root.left = this.insert(root.left, data);
    } else {
      root.right = this.insert(root.right, data);
    }
    return root;
  },

  search: function (data) {
    var recurseSearch = function (root) {
      if (this.root == null || root == null) {
        return false;
      } else if (root.data === data) {
        return true;
      } else if (data <= root.data) {
        recurseSearch(root.left);
      } else {
        recurseSearch(root.right);
      }
    }.bind(this);

    recurseSearch(this.root, data);
  }

  remove: function (value) {

  }
}

module.exports = BinarySearchTree;<commit_msg>add finding min and max<commit_after>var Node = function (data, left, right) {
  this.data = data;
  this.left = left;
  this.right = right;
}

var BinarySearchTree = function () {
  this.root = null;
}

BinarySearchTree.prototype = {
  constructor: BinarySearchTree,

  insert: function (root, data) {
    if (root == null) {
      root = new Node(data);

      if (this.root === null)
        this.root = root;
    } else if (data <= root.data){
      root.left = this.insert(root.left, data);
    } else {
      root.right = this.insert(root.right, data);
    }
    return root;
  },

  search: function (data) {
    var recurseSearch = function (root) {
      if (this.root == null || root == null) {
        return false;
      } else if (root.data === data) {
        return root;
      } else if (data <= root.data) {
        recurseSearch(root.left);
      } else {
        recurseSearch(root.right);
      }
    }.bind(this);

    recurseSearch(this.root, data);
  }

  findMin: function () {
    var minRecurse = function (root) {
      if (root == null) {
        throw 'Error: Tree is empty';
      } else if (root.left == null) {
        return root.data;
      }
      return minRecurse(root.left);
    }

    this.minRecurse(this.root)
  },

  findMax: function () {
    var maxRecurse = function (root) {
      if (root == null) {
        throw 'Error: Tree is empty';
      } else if (root.left == null) {
        return root.data;
      }
      return minRecurse(root.right);
    }
  },

  remove: function (value) {

  }
}

module.exports = BinarySearchTree;
{'fraction_non_alphanumeric': 0.14225621414913958, 'fraction_numerical': 0.0, 'mean_word_length': 2.2256473489519113, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1429888', 'n_tokens_mistral': 875, 'n_tokens_neox': 851, 'n_words': 214}