| 14 | } |
| 15 | |
| 16 | class BST { |
| 17 | constructor(value) { |
| 18 | this.value = value; |
| 19 | this.left = null; |
| 20 | this.right = null; |
| 21 | } |
| 22 | |
| 23 | insert(value) { |
| 24 | if (value < this.value) { |
| 25 | if (this.left === null) { |
| 26 | this.left = new BST(value); |
| 27 | } else { |
| 28 | this.left.insert(value); |
| 29 | } |
| 30 | } else { |
| 31 | if (this.right === null) { |
| 32 | this.right = new BST(value); |
| 33 | } else { |
| 34 | this.right.insert(value); |
| 35 | } |
| 36 | } |
| 37 | } |
| 38 | } |
nothing calls this directly
no outgoing calls
no test coverage detected