mirror of
https://github.com/trekhleb/javascript-algorithms.git
synced 2025-12-19 08:59:05 +08:00
Add binary search tree.
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import BinarySearchTreeNode from './BinarySearchTreeNode';
|
||||
|
||||
export default class BinarySearchTree {
|
||||
constructor() {
|
||||
this.root = new BinarySearchTreeNode();
|
||||
}
|
||||
|
||||
insert(value) {
|
||||
this.root.insert(value);
|
||||
}
|
||||
|
||||
contains(value) {
|
||||
return this.root.contains(value);
|
||||
}
|
||||
|
||||
toString() {
|
||||
this.root.toString();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user