mirror of
https://github.com/trekhleb/javascript-algorithms.git
synced 2026-03-13 08:51:02 +08:00
Make it possible to use objects as a values for binary search tree nodes.
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user