explain algo instead of writing the code.....
thanx
On Mon, Feb 14, 2011 at 9:28 PM, jalaj jaiswal <[email protected]>wrote:
> @tushar that would modify the tree structure
>
> here is a different approach
>
> int count=0; //global
> void modified_inorder(node *root){
> if(root!=NULL){
> modified_inorder(root->left);
> node *temp;
> if(count==0){
> root->p=NULL;
> temp=root;
> count++;
> }
> else{
> if(root->p!=temp){
> root->p=NULL;
> }
> temp=root;
>
> }
>
> }
>
> On Mon, Feb 14, 2011 at 7:59 PM, Tushar Bindal <[email protected]>wrote:
>
>> I think the following algo should work:
>> 1. Create a DLL of the inorder traversal of the tree
>> 2. for each node, check whether P of that node points to the previous node
>> in the DLL or not.
>> 3. If not, assign it value NULL
>>
>>
>>
>> --
>> Tushar Bindal
>> Computer Engineering
>> Delhi College of Engineering
>> Mob: +919818442705
>> E-Mail : [email protected], [email protected]
>>
>> --
>> 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.
>>
>
>
>
> --
> With Regards,
> *Jalaj Jaiswal* (+919019947895)
> Software developer, Cisco Systems
> B.Tech IIIT 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.
>
--
Sanchit Mittal
Second Year Undergraduate
Computer Engineering
Delhi College of Engineering
ph- +919582414494
--
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.