* Remove a value from the binary search tree if it exists in the tree. * * The complexity of this operation is on average O(log n), where n is the * number of values in the tree. In the worst case, the complexity is O(n). * * @example Removing values from the tree * ```ts * impo
(value: T)
| 461 | * @returns `true` if the value was found and removed, `false` if the value was not found in the tree. |
| 462 | */ |
| 463 | remove(value: T): boolean { |
| 464 | const node: BinarySearchNode<T> | null = this.#findNode(value); |
| 465 | if (node) this.#removeNode(node); |
| 466 | return node !== null; |
| 467 | } |
| 468 | |
| 469 | /** |
| 470 | * Check if a value exists in the binary search tree. |
nothing calls this directly
no test coverage detected