remove1 [BST] Construct binary search tree methods :: insert, contains, remove(delete) BST definition BST class BST { constructor(value) { this.value = value; this.left = null; this.right = null; } insert(value) { let currentNode = this; while (currentNode !== null) { if (currentNode.value > value) { if (currentNode.left === null) { currentNode.left = new BST(value); } else { currentNode.left.insert(value); } } else { if (currentNode.right === null) { currentNode.right = new BST(v.. 2022. 7. 4. 이전 1 다음