pgm to find middle element of linklist(in efficent manner)

Answer Posted / sharan

NODE display_middle(NODE first)
{
int count = 0;
NODE temp,mid;

for ( temp = mid = first, count=0; temp ; temp = temp ->
link,count++)

{
if ( count % 2 )
{
mid = mid -> link;
}
}
return mid;
}

Is This Answer Correct ?    6 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the advantage of an array over individual variables?

728


Is anything faster than c?

577


What is difference between structure and union?

593


What is string constants?

653


What is the use of typedef in structure in c?

536






What is file in c language?

572


Distinguish between actual and formal arguments.

587


What is a rvalue?

743


in ‘C’ language for Matrix Multiplication fails” Introspect the causes for its failure and write down the possible reasons for its failure.

7385


What is 'bus error'?

638


i have to apply for rbi before that i need to know the the syllabus for the entrance questions. whethet it may be aps or techinical

1836


What is New modifiers?

662


Write a C program to accept a matrix of any size. Find the frequency count of each element in the matrix and positions in which they appear in the matrix

1507


What is the use of function overloading in C?

672


Why header files are used?

639