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

how do you write a function that takes a variable number of arguments? What is the prototype of printf () function?

1949


Write a program to show the change in position of a cursor using c

1080


what is a constant pointer in C

1192


What is c variable?

1050


hello freinds next week my interview in reliance,nybody has an idea about it intervew questions..so tell

2183


Differentiate abs() function from fabs() function.

1028


List the difference between a 'copy constructor' and a 'assignment operator' in C?

1098


What is the difference between array_name and &array_name?

1312


Difference between malloc() and calloc() function?

1214


What are the uses of null pointers?

1139


Write the program with at least two functions to solve the following problem. The members of the board of a small university are considering voting for a pay increase for their 10 faculty members. They are considering a pay increase of 8%. Write a program that will prompt for and accept the current salary for each of the faculty members, then calculate and display their individual pay increases. At the end of the program, print the total faculty payroll before and after the pay increase, and the total pay increase involved.

3121


Write a function which takes as parameters one regular expression(only ? and * are the special characters) and a string and returns whether the string matched the regular expression.

1111


I heard that you have to include stdio.h before calling printf. Why?

1080


i want to know the procedure of qualcomm for getting a job through offcampus

2477


What is strcpy() function?

1176