DFS Preorder

Category: Trees & BSTs

Difficulty: beginner

Description: Visit root, left, then right subtree

Time Complexity: O(n)

Space Complexity: O(h)

Related LeetCode Problems