#K13331. Level Linked List from Binary Tree
Level Linked List from Binary Tree
Level Linked List from Binary Tree
Given a binary tree represented in level-order and using the keyword (\texttt{null}) for missing nodes, your task is to create a linked list for each level of the tree. Each linked list should contain all the node values at that particular level. In the output, print the node values of each level on a separate line with a single space between values.
For example, if the input is:
7 1 2 3 4 5 6 7
Then the binary tree is:
1
/ \
2 3
/ \ / \
4 5 6 7
And the output should be:
1 2 3 4 5 6 7
inputFormat
The input is given via standard input (stdin). The first line contains an integer (n) representing the number of tokens in the level-order representation of the tree. The next line (or the same line) contains (n) tokens separated by spaces. Each token is either an integer (representing a node's value) or the literal (null) (without quotes) to denote missing nodes.
outputFormat
Print the values of the nodes in the binary tree level by level. Each level's values should be printed on a new line with a single space between adjacent values. The output is written to standard output (stdout).## sample
7
1 2 3 4 5 6 7
1
2 3
4 5 6 7
</p>