MCPcopy Create free account
hub / github.com/neetcode-gh/leetcode / getLeft

Method getLeft

javascript/0173-binary-search-tree-iterator.js:26–32  ·  view source on GitHub ↗

* Time O(N) | Space O(H) * @return {number}

(root, { stack } = this)

Source from the content-addressed store, hash-verified

24 * @return {number}
25 */
26 getLeft(root, { stack } = this) {
27 while (root !== null) {
28 /* Time O(N) */
29 stack.push(root); /* Space O(N) */
30 root = root.left;
31 }
32 }
33
34 /**
35 * Time O(N) | Space O(N)

Callers 2

constructorMethod · 0.95
nextMethod · 0.95

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected