Given a pointer to the root of a binary tree, you need to print the level order traversal of this tree. In level-order traversal, nodes are visited level by level from left to right. Complete the function and print the values in a single line separated by a space.
The levelOrder
function takes an input parameter of a root node of a binary tree. Determine the level order traversal, left to right at each level. Print these node's values, space separated.
- 1 <= Nodes in the tree <= 500