G
Guest
I have an algorithm question and don't know how to do it nicely.
Write a function to print nodes of binary tree, for each leaf node, print nodes from root node to leaf node.
For example, the following binary tree has 4 leaf nodes.
30
25 36
39 40 10 64
The resulting of print should be :
30, 25, 39
30, 25, 40
30, 36, 10
30, 36, 64
Write a function to print nodes of binary tree, for each leaf node, print nodes from root node to leaf node.
For example, the following binary tree has 4 leaf nodes.
30
25 36
39 40 10 64
The resulting of print should be :
30, 25, 39
30, 25, 40
30, 36, 10
30, 36, 64