🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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?

  1. A.O(1)
  2. B.O(h)
  3. C.O(n²)
  4. 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 →