bool checkTree(Tree node)
{
if(node[right]==NULL&&node[left]==NULL)
return true;
if(node[right]==NULL&&node[left]!=NULL||node[left]==NULL&&node[right]!=NULL)
return false;
else
return checkTree(node[right])&&checkTree(node[left]);
}

i think this algo can solve problem just traverse the node and keep eye on
that either a node have 2 childs or no child

On Wed, Jul 4, 2012 at 3:08 PM, Ashish Goel <[email protected]> wrote:

> i think checking full is easy, find height(0to h) and then check if level
> h has 2^(h+1) nodes
>
> how to check if it is complete..level order traversal? ensure that every
> node has two children or left for the last one just before first leaf( till
> you find the first leaf). Now on, every node should be a leaf.
>
>
> Best Regards
> Ashish Goel
> "Think positive and find fuel in failure"
> +919985813081
> +919966006652
>
>
> On Wed, Jul 4, 2012 at 2:36 PM, Ashish Goel <[email protected]> wrote:
>
>> ok, lets modify the problem to find if the tree is complete binary tree
>>
>> The tree is a complete binary tree; that is, all levels of the tree,
>> except possibly the last one (deepest) are fully filled, and, if the last
>> level of the tree is not complete, the nodes of that level are filled from
>> left to right
>>
>>
>>
>> Best Regards
>> Ashish Goel
>> "Think positive and find fuel in failure"
>> +919985813081
>> +919966006652
>>
>>
>> On Wed, Jul 4, 2012 at 11:09 AM, atul anand <[email protected]>wrote:
>>
>>> http://www.geeksforgeeks.org/archives/5230
>>> modify this to meet the requirnment.
>>>
>>> On 7/4/12, Ashish Goel <[email protected]> wrote:
>>> > WAP to find if a tree is balanced/fully balanced?
>>> >
>>> > Best Regards
>>> > Ashish Goel
>>> > "Think positive and find fuel in failure"
>>> > +919985813081
>>> > +919966006652
>>> >
>>> > --
>>> > 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.
>



-- 
Thanks & Regards
Amritpal singh

-- 
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.

Reply via email to