← 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?
- A.O(log n)
- B.O(n)
- C.O(n log n)
- 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 →