* MINIMAL TREE * Given a sorted (increasing order) array with unique integer values, * write an algorithm to create a binary search tree (BST) with * minimal height * * Time O(n) - where n is the length of the input array * Space O(n)
| 9 | */ |
| 10 | |
| 11 | class Node { |
| 12 | constructor(value) { |
| 13 | this.value = value; |
| 14 | this.left = null; |
| 15 | this.right = null; |
| 16 | } |
| 17 | } |
| 18 | |
| 19 | function createMinimalBST(arr) { |
| 20 | return createMinimalBSTHelper(arr, 0, arr.length - 1); |
nothing calls this directly
no outgoing calls
no test coverage detected