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
how do you write a function that takes a variable number of arguments? What is the prototype of printf () function?
Write a program to show the change in position of a cursor using c
what is a constant pointer in C
What is c variable?
hello freinds next week my interview in reliance,nybody has an idea about it intervew questions..so tell
Differentiate abs() function from fabs() function.
List the difference between a 'copy constructor' and a 'assignment operator' in C?
What is the difference between array_name and &array_name?
Difference between malloc() and calloc() function?
What are the uses of null pointers?
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.
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.
I heard that you have to include stdio.h before calling printf. Why?
i want to know the procedure of qualcomm for getting a job through offcampus
What is strcpy() function?