We can do the following. We associate a variable with each of the node. let it be called level. We now do BFS on the tree. Whenever we visit a node we do the following:
node.level = blackNeigbor.level + 1. Now we again do a BFS to find the number of nodes in each level. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
