First version of 1004.c which is partially correct.This version use first-child/next-sibling representation of tree and use a queue to do breadth first search.
Second version of 1004.c which is also partially correct.This version is wrong because we can't know the node's level on the fly.
1005
1006
1007 not completed