Re: [algogeeks] Special Binary Tree Again

2011-02-14 Thread jalaj jaiswal
@ sanchit m dong inorder traversal and at every step chking whether the node's p pointer is pointing to its inorder predecesor, which is temp or not and making it NULL otherwise. when count is 0 the node do not hv any predecessor so m directly pointing that to NULL. *please see the below alg0 , th

Re: [algogeeks] Special Binary Tree Again

2011-02-14 Thread sanchit mittal
explain algo instead of writing the code. thanx On Mon, Feb 14, 2011 at 9:28 PM, jalaj jaiswal 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){ > modifie

Re: [algogeeks] Special Binary Tree Again

2011-02-14 Thread jalaj jaiswal
@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;

Re: [algogeeks] Special Binary Tree Again

2011-02-14 Thread Tushar Bindal
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: +919

Re: [algogeeks] Special Binary Tree Again

2011-02-14 Thread SEHAJ SINGH KALRA
What is meant by : "preceding P’s node in the in-order traversal of the tree" ? On Mon, Feb 14, 2011 at 7:03 PM, bittu wrote: > You have a tree, in which each node has an additional pointer, P. P > can either be NULL or point a node preceding P’s node in the in-order > traversal of the tree. Wr

[algogeeks] Special Binary Tree Again

2011-02-14 Thread bittu
You have a tree, in which each node has an additional pointer, P. P can either be NULL or point a node preceding P’s node in the in-order traversal of the tree. Write a program to check in a tree if each node’s P is assigned correctly. If not, make P null Thanks Shashank -- You received this mes