Print a Binary Tree Level by Level - BFS using Queue

preview_player
Показать описание
Given a binary tree, write a method to print the tree level by level.

Example:
1
/ \
2 3
/ \ / \
4 5 6 7

== [1][2, 3][4, 5, 6, 7]

Note: Each item in the list is an ArrayList of the format [A[], B,[] .....], where A[],B[].... are the nodes at a particular level, stored in an ArrayList.

#interviewdose #bfs
Рекомендации по теме