bfs
On Sun, Sep 11, 2011 at 1:51 PM, vijay goswami <[email protected]>wrote:
> countNodeAtEachLevel(node * T, int a[],int level)
> {
> if(T!=NULL){
> a[level]+=1;
> countNodeAtEachLevel(T->left,a,level+1);
> countNodeAtEachLeve(T->right,a,level+1);
> }
> }
>
> The function is called with initial values
> countNodeAtEachLevel(Root,a,0);
>
>
> the array a[] gives the number of nodes at each level
> a[i] denotes number of nodes at level i, where i ranges between log(n) and
> n
>
>
>
>
> On Sun, Aug 21, 2011 at 9:47 AM, Amol Sharma <[email protected]>wrote:
>
>> yes....bfs will do !!
>> --
>>
>>
>> Amol Sharma
>> Third Year Student
>> Computer Science and Engineering
>> MNNIT Allahabad
>> <http://gplus.to/amolsharma99>
>> <http://twitter.com/amolsharma99><http://in.linkedin.com/pub/amol-sharma/21/79b/507><http://youtube.com/amolsharma99>
>>
>>
>>
>>
>>
>> On Sun, Aug 21, 2011 at 9:37 AM, Naman Mahor <[email protected]>wrote:
>>
>>> ght modification. so in bfs we use queue we have to add a dummy node in
>>> queue. So this node will tell us that end of level has come.so we can find
>>> out the no of node at any lev
>>
>>
>> --
>> 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.
>>
>
> --
> 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.
>
--
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.