@Ankit- I think it can be done using a single queue also. 2010/10/23 ankit agarwal <[email protected]>
> Do level order traversal using two queues. > > > On Oct 23, 8:19 pm, "juver++" <[email protected]> wrote: > > When visiting appropriate vertex v, increment counter + > > +levels[current_depth] and go further. > > You may done this using DFS or BFS. > > > > On 23 окт, 17:31, Harshal <[email protected]> wrote: > > > > > > > > > > > > > > > > > hi, i need to find the number of nodes at each level of a binary > tree..the > > > binary tree may not be balanced.. > > > > > output: > > > Level 0 - 1 node > > > Level 1 - 2 nodes > > > Level 2- 3 nodes > > > > > and so on..based on the tree structure..I am not able to count at each > > > level..pls suggest a way to do that. > > > > > -- > > > Harshal Choudhary > > -- > 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]<algogeeks%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > > -- 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.
