Question DSA-TREE-0005
EasyWhich traversal visits nodes level by level?
- A.
Level-order (breadth-first) traversal
- B.
Postorder traversal
- C.
Show answer and explanation
Answer: A
It uses a queue to visit all nodes at depth 0, then depth 1, and so on.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
Trees question
Which traversal visits nodes level by level?
Level-order (breadth-first) traversal
Postorder traversal
Answer: A
It uses a queue to visit all nodes at depth 0, then depth 1, and so on.
Inorder traversal
Preorder traversal