Skip to content

Tree Traversal

Info

DFS will only store as much memory on the stack as is required for the longest root to leaf path in the tree. In other words, it space usage is $\(\text{O}(h)\)$ where $\(h\)$ is the height of the tree.

Comments