🎙 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 8 of 13

What is the time complexity of any of the four traversals on n nodes?

What is the time complexity of any of the four traversals on n nodes?

  1. A.O(log n)
  2. B.O(n)
  3. C.O(n log n)
  4. D.O(n²)
Answer & explanation

Correct answer: O(n)

Each node is visited exactly once.

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 →