Make it possible to use objects as a values for binary search tree nodes.

This commit is contained in:
Oleksii Trekhleb
2018-05-30 07:43:39 +03:00
parent 3ae9c40416
commit 797a6f28a3
3 changed files with 82 additions and 7 deletions

View File

@@ -5,18 +5,31 @@ export default class BinarySearchTree {
this.root = new BinarySearchTreeNode();
}
/**
* @param {*} value
*/
insert(value) {
this.root.insert(value);
}
/**
* @param {*} value
* @return {boolean}
*/
contains(value) {
return this.root.contains(value);
}
/**
* @param {*} value
*/
remove(value) {
return this.root.remove(value);
}
/**
* @return {string}
*/
toString() {
return this.root.toString();
}