← Quiz: Tree Traversals: all 13 questions
Quiz: Tree Traversals · Question 4 of 13
What extra space does a recursive traversal use on a tree of height h?
What extra space does a recursive traversal use on a tree of height h?
- A.O(1)
- B.O(h)
- C.O(n²)
- D.O(log h)
Answer & explanation
Correct answer: O(h)
The call stack holds one frame per level of the current path from the root.
Can you get the rest right without peeking?
Take the timed Quiz: Tree Traversals quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →