one another solution using counting array...
void findwidth(BST* bt, int *arr, int count)//initially count is 0 for root
{
if(bt)
return;
arr[count]++;
count++;
if(bt->left)
findwidth(bt->left, arr, count);
if(bt->right)
findwidth(bt->right, arr, count);
ret
use levelorder traversal and calculate the number of node in same level by
putting some condition :)
On Mon, Jul 26, 2010 at 1:53 PM, vineel yalamarth <
vineelyalamar...@gmail.com> wrote:
>
>
> No dude, they asked me to find width , in the sense ... find the maximum
> number of nodes in any leve
No dude, they asked me to find width , in the sense ... find the maximum
number of nodes in any level.
And if you know how to find the diameter do post it
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email t
shldnt max width be equal to diameter of the treecorrect me if im
wrong
On Mon, Jul 26, 2010 at 1:28 PM, vineel yalamarth <
vineelyalamar...@gmail.com> wrote:
>
>
> Dear Sharad,Maximum width of the tree you had drawn is 2...(3,8),(1,4)
>
>
>
>
> --
> You received this message because you
Dear Sharad,Maximum width of the tree you had drawn is 2...(3,8),(1,4)
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+u
5
/ \
3 8 max width is 4 (1-3-5-8) am i riteif so then use the approach as
i stated earlier ...
/ \
1 4
On Mon, Jul 26, 2010 at 1:03 PM, Sathaiah Dontula wrote:
> I mean "maximum number of nodes in a breadth of a BST".
>
> Thanks,
> Sathaiah
>
> On Mon, Jul 26, 2010 at 1:00 PM,
I mean "maximum number of nodes in a breadth of a BST".
Thanks,
Sathaiah
On Mon, Jul 26, 2010 at 1:00 PM, sharad kumar wrote:
> the max width of bst is the largets diff betweeen the min node and max node
> rite?
>
>
> On Mon, Jul 26, 2010 at 12:30 PM, Chunyuan Ge wrote:
>
>> breadth-favorit
the max width of bst is the largets diff betweeen the min node and max node
rite?
On Mon, Jul 26, 2010 at 12:30 PM, Chunyuan Ge wrote:
> breadth-favorite search?
>
>
> On Mon, Jul 26, 2010 at 2:28 PM, Sathaiah Dontula wrote:
>
>> You mean maximum width of bst ?
>>
>> You can use BST to find
breadth-favorite search?
On Mon, Jul 26, 2010 at 2:28 PM, Sathaiah Dontula wrote:
> You mean maximum width of bst ?
>
> You can use BST to find the same.
>
> Thanks,
> Sathaiah
>
>
> On Mon, Jul 26, 2010 at 11:47 AM, aparichith
> wrote:
>
>> Can some one tell me the algorithm to find out the wid
You mean maximum width of bst ?
You can use BST to find the same.
Thanks,
Sathaiah
On Mon, Jul 26, 2010 at 11:47 AM, aparichith wrote:
> Can some one tell me the algorithm to find out the width of a binary
> search tree.
>
> --
> You received this message because you are subscribed to the Googl
Can some one tell me the algorithm to find out the width of a binary
search tree.
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to
11 matches
Mail list logo