it should be O(n)
where n is number of nodes as we get into the function once for a node.
we just perform some O(1) operations to do the swapping.

On Thu, Jul 28, 2011 at 8:05 PM, ambika iyer <[email protected]> wrote:

> how to find the complexity of the above recursive code ????
>
>
> On Thu, Jul 28, 2011 at 8:02 PM, sagar pareek <[email protected]>wrote:
>
>> viod mirror(node *root)
>> {
>>  node* tmp;
>>  if(root)
>>  {
>>   mirror(root->left);
>>   mirror(root->right);
>>
>>   tmp=root->left;
>>   root->left=root->right;
>>   root->right=tmp;
>>
>>  }
>> }
>>
>> On Thu, Jul 28, 2011 at 6:40 PM, Piyush Sinha 
>> <[email protected]>wrote:
>>
>>> http://www.ideone.com/NyAmw
>>>
>>>
>>> On Thu, Jul 28, 2011 at 5:48 PM, Coder Coder 
>>> <[email protected]>wrote:
>>>
>>>> Can anyone tell me the iterative code to find mirror image of a binary
>>>> tree??
>>>>
>>>>
>>>> thanx..
>>>>
>>>> --
>>>> 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.
>>>>
>>>
>>>
>>>
>>> --
>>> *Piyush Sinha*
>>> *IIIT, Allahabad*
>>> *+91-7483122727*
>>> * <https://www.facebook.com/profile.php?id=100000655377926> "NEVER SAY
>>> NEVER"
>>> *
>>>
>>>  --
>>> 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.
>>>
>>
>>
>>
>> --
>> **Regards
>> SAGAR PAREEK
>> COMPUTER SCIENCE AND ENGINEERING
>> NIT ALLAHABAD
>>
>>  --
>> 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.
>>
>
>
>
> --
> Ambi :)
>
>  --
> 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.
>



-- 
Tushar Bindal
Computer Engineering
Delhi College of Engineering
Mob: +919818442705
E-Mail : [email protected]
Website: www.jugadengg.com

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