MCPcopy Create free account
hub / github.com/betomoedano/JavaScript-Coding-Interview-Questions / Node

Class Node

binary-trees/minimal-tree.js:11–17  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

9 */
10
11class Node {
12 constructor(value) {
13 this.value = value;
14 this.left = null;
15 this.right = null;
16 }
17}
18
19function createMinimalBST(arr) {
20 return createMinimalBSTHelper(arr, 0, arr.length - 1);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected