Challenge: Print Level Order Line by Line Using Two Queues
Let’s print the level-order traversal of a binary tree using two queues.
We'll cover the following
Problem
Given a binary tree, perform a level-order line-by-line traversal by completing the PrintLevelOrderLineByLine()
function. This time, try to solve the problem using two queues. For more information about the level-order traversal, refer to this lesson.
Input
A binary tree.
Output
Display the level-order traversal of the tree on the console.
Sample input
Get hands-on with 1400+ tech skills courses.