Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

how to find out the inorder successor of a node in a tree??

Answer Posted / shruti

inorder trraversal is
left - vertex - right.

hence to find the successor of a node.

consider N node . we have to find the inorder successor of
N.
then,

if(n -> right != NULL)
n = n -> right. /* this is the successor of n.
else
{
n = pop();
(/* we have to pop the address of the node above n, which
we have pushed earlier while traversing leftwards*/)
/*n will be hte successor node.
}


in inorder traversal we have number in ascending order in a
binary search tree.
hence the successor always is to the right, if exists,
or one level above.

**Go through the inorder traversal program to get a better
picture.

Is This Answer Correct ?    11 Yes 27 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

explain what are actual arguments?

1035


How can I remove the trailing spaces from a string?

1028


What are the types of data files?

1154


Explain what is the benefit of using #define to declare a constant?

1097


What is queue in c?

1038


List the difference between a While & Do While loops?

1055


What does. int *x[](); means ?

1018


When should the const modifier be used?

1062


why to assign a pointer to null sometimes??how can a pointer we declare get assigned with a garbage value by default???

1916


What are external variables in c?

1042


Explain output of printf("Hello World"-'A'+'B'); ?

1434


What is meant by operator precedence?

1098


Write a program to reverse a given number in c?

987


process by which one bit patten in to another by bit wise operation is? (a) masking, (b) pruning, (c) biting, (d) chopping,

2361


What is the collection of communication lines and routers called?

1062